aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorGravatar Brendan Taylor <whateley@gmail.com>2011-05-23 02:12:05 +0000
committerGravatar Brendan Taylor <whateley@gmail.com>2011-05-23 02:12:05 +0000
commite8b26f75819ff32b8810484178a88784af6d4192 (patch)
tree86c6dcc4a373e51eef72b914b0b124324895122b /misc
parent7281314db93b1b126d06787cd54d83e419703934 (diff)
make uzbl-core --version's output nicer
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/hash.sh18
1 files changed, 8 insertions, 10 deletions
diff --git a/misc/hash.sh b/misc/hash.sh
index 0c97722..3590981 100755
--- a/misc/hash.sh
+++ b/misc/hash.sh
@@ -1,20 +1,18 @@
#!/bin/sh
-# script to determine git hash of current source tree
+# script to determine git hash and latest tag of current source tree
-# set a variable when running `git --archive <hash/tag>` (this is what github does)
+# set a variable when running `git archive <hash/tag>` (this is what github does)
# alternatively, you could also git get-tar-commit-id < tarball (but that's a bit dirtier)
-FROM_ARCHIVE=$Format:%H$
+
+# the `%` expansions possible here are described in `man git-log`
+FROM_ARCHIVE=$Format:%h$
# ... but try to use whatever git tells us if there is a .git folder
if [ -d .git -a -r .git ]
then
- hash=$(git log 2>/dev/null | head -n1 2>/dev/null | sed "s/.* //" 2>/dev/null)
-fi
-
-if [ x"$hash" != x ]
-then
- echo $hash
-elif [ "$FROM_ARCHIVE" != ':%H$' ]
+ hash=$(git describe --tags)
+ echo $hash
+elif [ "$FROM_ARCHIVE" != ':%h$' ]
then
echo $FROM_ARCHIVE
else