diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-04 03:05:46 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2008-11-04 03:05:46 +0000 |
commit | 4576a64e7228a25cfe2b8433795c3ca1801ec7a1 (patch) | |
tree | 621214349f6ea01e1feaebd729051081f49bc39e /tools | |
parent | de6cddaea246241abe118df548aa3a728a2f43f0 (diff) |
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
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/svnversion.sh | 20 |
1 files changed, 19 insertions, 1 deletions
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 |