sys/sys/conf.h - Add GID_TTY #define
[dragonfly.git] / tools / gitrev.sh
blob94ba59efdd90e30814c424bd41e79103b5f619c1
1 #!/bin/sh
3 # We might be run during buildkernel/world, where PATH is
4 # limited. To reach git, we need to add the directories
5 # git might be located in. Not a very nice solution, but
6 # it works well enough.
7 PATH=$PATH:/usr/pkg/bin:/usr/local/bin
9 srcdir=${1:-$(dirname $0)}
11 [ -n "$srcdir" ] && cd "$srcdir"
13 if ! git version >/dev/null 2>&1 ||
14 ! cd "$(dirname "$0")" ||
15 ! git rev-parse --git-dir >/dev/null 2>&1
16 then
17 exit 0
20 v=$(git describe --abbrev=5 2>/dev/null || git rev-parse --short HEAD)
21 git update-index -q --refresh
22 v=$(echo "$v" | sed -e 'y/-/./')
23 [ -z "$(git diff-index --name-only HEAD --)" ] || v="$v*"
25 echo "$v"
26 exit 0