diff options
author | Nicolas Williams <nico@cryptonector.com> | 2017-03-03 14:28:58 -0600 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2017-03-03 14:30:58 -0600 |
commit | f7bf9a8e96801d1aaef6148929098c1c92024378 (patch) | |
tree | ede5e54262720c119755983eb427d6b52d51679a /scripts | |
parent | 89809a2d0f82500570cc2c33739fee10c173896a (diff) |
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.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/version | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/version b/scripts/version index d1f0c29e..0e8094c2 100755 --- a/scripts/version +++ b/scripts/version @@ -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 |