aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorGravatar keis <keijser@gmail.com>2011-07-28 22:31:30 +0200
committerGravatar keis <keijser@gmail.com>2011-07-28 22:31:30 +0200
commitdb61f092140205e71f40fb14dc98a1e650c7e527 (patch)
tree6a2459ae08c6baa4875b1db226dc7eb615a3cd3c /misc
parent1e20430333aee952f55f6caec4d55238a0160bf9 (diff)
parente035f6f991fdbe9862a72fba6e8d348dcc25532f (diff)
Merge branch 'experimental' of git://github.com/Dieterbe/uzbl into mouse-events
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