Summary Files Commits Branches @commit @diff @stats
path: root / version.sh
blob: 0c9d3d640fb48c5c7090acd80784aa02673654e9 (plain) (blame)
1
2
3
4
5
6
7
8
9
#!/bin/sh
hash=$(git --git-dir="$(dirname $0)/.git" rev-parse --short HEAD 2>/dev/null)
branch=$(git --git-dir="$(dirname $0)/.git" rev-parse --abbrev-ref HEAD | sed -r 's/.*[^0-9A-Za-z-]([0-9A-Za-z-]*)$/\1/g')

if [ -n "$hash" ] || [ -n "$branch" ]
then
	printf '+g%s.%s' "$hash" "$branch"
fi
echo