summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authoritchyny <itchyny@cybozu.co.jp>2023-07-20 23:12:41 +0900
committerNico Williams <nico@cryptonector.com>2023-07-21 08:59:17 -0500
commit3ed928954a0365828d53ac1fd6a41343b4dbff7d (patch)
treee553ad761140fba493a54f8e3daf2fabe2fb987d /scripts
parent4732dd82c09468884fbe0a4b366ea1baf674c573 (diff)
Fail quickly if not in git repository in scripts/version
Diffstat (limited to 'scripts')
-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