summaryrefslogtreecommitdiffstats
path: root/scripts/version
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/version')
-rwxr-xr-xscripts/version4
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/version b/scripts/version
index d56dd9a7..ba59e6b6 100755
--- a/scripts/version
+++ b/scripts/version
@@ -1,7 +1,9 @@
#!/bin/sh
set -eu
-cd "$(dirname "$0")"
+cd "$(dirname "$0")/../"
+test -d .git || exit 1
+
if git describe --tags --match 'jq-*' >/dev/null 2>&1; then
git describe --tags --match 'jq-*' --dirty | sed 's/^jq-//'
else