From e8b26f75819ff32b8810484178a88784af6d4192 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Mon, 23 May 2011 02:12:05 +0000 Subject: make uzbl-core --version's output nicer --- misc/hash.sh | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'misc') 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 ` (this is what github does) +# set a variable when running `git archive ` (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 -- cgit v1.2.3