From: Mike Frysinger Date: Mon, 20 Sep 2010 18:36:18 +0000 (-0400) Subject: setlocalversion: add some more fallbacks for git describe X-Git-Tag: v2010.09~10^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16e66cf194f6d4c748f3c02689e6cd1aa4440c0e;p=kernel%2Fu-boot.git setlocalversion: add some more fallbacks for git describe 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 --- diff --git a/tools/setlocalversion b/tools/setlocalversion index b3f5f28..e11f54f 100755 --- a/tools/setlocalversion +++ b/tools/setlocalversion @@ -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?