Summary Files Commits Branches @commit @diff @stats
path: root / version.sh
diff options
context:
space:
mode:
1 files changed, 3 insertions, 2 deletions
-rwxr-xr-xversion.sh5
diff --git a/version.sh b/version.sh
index 318aa72..0c9d3d6 100755
--- a/version.sh
+++ b/version.sh
@@ -1,8 +1,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" ]
+if [ -n "$hash" ] || [ -n "$branch" ]
then
- printf '+g%s' "$hash"
+ printf '+g%s.%s' "$hash" "$branch"
fi
echo