emx: Remove unused macros
[dragonfly.git] / tools / gitrev.sh
CommitLineData
7f1cdf2d
SS
1#!/bin/sh
2
ea9c9026
SS
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.
7PATH=$PATH:/usr/pkg/bin:/usr/local/bin
8
f5a0be59
SS
9srcdir=${1:-$(dirname $0)}
10
11[ -n "$srcdir" ] && cd "$srcdir"
12
ea9c9026 13if ! git version >/dev/null 2>&1 ||
7f1cdf2d
SS
14 ! cd "$(dirname "$0")" ||
15 ! git rev-parse --git-dir >/dev/null 2>&1
16then
7f1cdf2d
SS
17 exit 0
18fi
19
ea9c9026 20v=$(git describe --abbrev=5 2>/dev/null || git rev-parse --short HEAD)
ea9c9026 21v=$(echo "$v" | sed -e 'y/-/./')
9b10ce04
SS
22
23# Takes too long when running over NFS
24#git update-index -q --refresh
25#[ -z "$(git diff-index --name-only HEAD --)" ] || v="$v*"
7f1cdf2d
SS
26
27echo "$v"
28exit 0