Skip to content

Commit

Permalink
setlocalversion: do not describe if there is nothing to describe
Browse files Browse the repository at this point in the history
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 <sebastian@breakpoint.cc>
Acked-by: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
  • Loading branch information
Sebastian Siewior authored and Sam Ravnborg committed Jul 25, 2008
1 parent 12d2b8f commit 56b2f07
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/setlocalversion
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 56b2f07

Please sign in to comment.