diff options
Diffstat (limited to 'scripts/version')
-rwxr-xr-x | scripts/version | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/scripts/version b/scripts/version index 0e8094c2..d56dd9a7 100755 --- a/scripts/version +++ b/scripts/version @@ -1,10 +1,11 @@ #!/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-//' +set -eu + +cd "$(dirname "$0")" +if git describe --tags --match 'jq-*' >/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}" + branch=$(git rev-parse --abbrev-ref HEAD) + commit=$(git describe --always --dirty) + echo "${branch}-${commit}" fi |