From 4576a64e7228a25cfe2b8433795c3ca1801ec7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Tue, 4 Nov 2008 03:05:46 +0000 Subject: [PATCH] svnversion.sh: extracts the revision number from git-svn repositories git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18998 a1c6a512-1295-4272-9138-f99709370657 --- tools/svnversion.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/svnversion.sh b/tools/svnversion.sh index 1744e98c6e..8fe9804622 100755 --- a/tools/svnversion.sh +++ b/tools/svnversion.sh @@ -16,7 +16,25 @@ svnversion_safe() { # LANG=C forces svnversion to not localize "exported". if OUTPUT=`LANG=C svnversion "$@"`; then if [ "$OUTPUT" = "exported" ]; then - echo "unknown" + + # Not a SVN repository, maybe a git-svn one ? + if [ -z "$1" ]; then + GITDIR="./.git" + else + GITDIR="$1/.git" + fi + + # First make sure it is a git repository + if [ -d "$GITDIR" ]; then + OUTPUT=`LANG=C git --git-dir="$GITDIR" svn info 2>/dev/null|grep '^Revision: '|cut -d\ -f2` + if [ -z "$OUTPUT" ]; then + echo "unknown" + else + echo "r$OUTPUT" + fi + else # not a git repository + echo "unknown" + fi else echo "r$OUTPUT" fi