summaryrefslogtreecommitdiffstats
path: root/scripts/version
blob: d56dd9a7d81c64d12ec6148a6d0f0232e0c2bf73 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
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
  branch=$(git rev-parse --abbrev-ref HEAD)
  commit=$(git describe --always --dirty)
  echo "${branch}-${commit}"
fi