Skip to content

Commit

Permalink
Make scripts/version work in shallow clones
Browse files Browse the repository at this point in the history
Shallow clones don't have tags.  Use git describe --always --dirty in
such cases.

XXX Add branch name.
  • Loading branch information
nicowilliams committed Mar 3, 2017
1 parent 89809a2 commit f7bf9a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/version
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh
set -e
cd `dirname "$0"`
git rev-parse --verify -q jq-1.0 > /dev/null 2>&1
git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//'
if git rev-parse --verify -q jq-1.0 > /dev/null 2>&1; then
git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//'
else
b=`git rev-parse --abbrev-ref HEAD`
c=`git describe --always --dirty`
echo "${b}-${c}"
fi

0 comments on commit f7bf9a8

Please sign in to comment.