mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Shallow clones don't have tags. Use git describe --always --dirty in such cases. XXX Add branch name.
11 lines
265 B
Bash
Executable File
11 lines
265 B
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
cd `dirname "$0"`
|
|
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
|