From: Sebastian Siewior Date: Tue, 1 Jul 2008 22:18:08 +0000 (+0200) Subject: setlocalversion: do not describe if there is nothing to describe X-Git-Tag: v2.6.27-rc1~58^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=56b2f0706d82535fd8d85503f2dcc0be40c8e55d;p=linux-2.6-omap-h63xx.git setlocalversion: do not describe if there is nothing to describe Jan Engelhardt wrote: > Just a note that when you run git-describe, you should probably quiten it. > > fatal: cannot describe 'bd7364a0fd5a4a2878fe4a224be1b142a4e6698e' > > This happens when tags are not present, which can happen if Linus's tree > is sent upwards again, IOW: > > machine1$ git-clone torvalds/linux-2.6.git > machine1$ git push elsewhere master > > machine2$ git-clone elsewhere:/linux > machine2$ git-describe HEAD > fatal: cannot describe that Signed-off-by: Sebastian Siewior Acked-by: Jan Engelhardt Signed-off-by: Sam Ravnborg --- diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 1c1bdaf7348..83b75126c9f 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -12,7 +12,9 @@ cd "${1:-.}" || usage 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))}' + if tag=`git describe 2>/dev/null`; then + echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}' + fi fi # Are there uncommitted changes?