USB - Fix compiler warning.
[dragonfly.git] / tools / gitrev.sh
blob37fbd93133003136788510659a8a072b37234d03
1 #!/bin/sh
3 if ! which git >/dev/null 2>&1 ||
4 ! cd "$(dirname "$0")" ||
5 ! git rev-parse --git-dir >/dev/null 2>&1
6 then
7 # XXX get version from newvers.sh?
8 echo "unknown"
9 exit 0
12 v=$(git describe --abbrev=4 HEAD 2>/dev/null || git rev-parse --short HEAD)
13 git update-index -q --refresh
14 [ -z "$(git diff-index --name-only HEAD --)" ] || v="$v-dirty"
16 v=$(echo "$v" | sed -e 's/-/./g;s/^v//;')
18 echo "$v"
19 exit 0