]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
setlocalversion: add some more fallbacks for git describe
authorMike Frysinger <vapier@gentoo.org>
Mon, 20 Sep 2010 18:36:18 +0000 (14:36 -0400)
committerWolfgang Denk <wd@denx.de>
Tue, 21 Sep 2010 19:33:16 +0000 (21:33 +0200)
If working out of a custom git tree that lacks annotated tags, the
'git describe' operation spews "fatal: cannot describe" errors all
over the place.  So add some fallback code in case the best naming
was unable to locate something useful.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
tools/setlocalversion

index b3f5f2824b1056352a1e229951e739a269837b35..e11f54f55ab0e5db943c2b6e879962aaf848ae97 100755 (executable)
@@ -13,7 +13,8 @@ if head=`git rev-parse --verify HEAD 2>/dev/null`; then
        # Do we have an untagged version?
        if git name-rev --tags HEAD | \
           grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
-               git describe | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
+               (git describe || git describe --tags || git describe --all --long) \
+                               2>/dev/null | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
        fi
 
        # Are there uncommitted changes?