Make scripts/version work in shallow clones

Shallow clones don't have tags.  Use git describe --always --dirty in
such cases.

XXX Add branch name.
This commit is contained in:
Nicolas Williams committed 2017-03-03 14:30:58 -06:00
1 parent 89809a2d0f
commit f7bf9a8e96
1 file changed
+6 -1
+6 -1
View File
@@ -1,5 +1,10 @@
#!/bin/sh
set -e
cd `dirname "$0"`
git rev-parse --verify -q jq-1.0 > /dev/null 2>&1
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