Skip to content

Commit

Permalink
Merge pull request uzbl#248 from keis/fix-misc-hash-script
Browse files Browse the repository at this point in the history
Use version tag when used from archive
  • Loading branch information
keis committed Apr 6, 2016
2 parents af1b49b + 046346a commit 5af1c22
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions misc/hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,20 @@
# alternatively, you could also git get-tar-commit-id < tarball (but that's a bit dirtier)

# the `%` expansions possible here are described in `man git-log`
tarball_check='$Format:$'
readonly tarball_check='$Format:$'

# ... but try to use whatever git tells us if there is a .git folder
if [ -d .git ] && [ -r .git ]; then
hash=$( git describe --tags --always )
echo $hash
elif [ -n "$tarball_check" ]; then
echo '$Format:%h$'
git describe --tags --always
elif [ -z "$tarball_check" ]; then
readonly tarball_tag="$(echo '$Format:%D$' | sed -n 's/.*tag: \(v[0-9]\.[0-9.]*\).*/\1/p')"
if [ -n "$tarball_tag" ]; then
echo "$tarball_tag"
else
echo '$Format:%h$'
fi
else
echo >&2 "Commit hash detection fail. Dear packager, please figure out what goes wrong or get in touch with us"
echo UNKNOWN
exit 2
fi

:

0 comments on commit 5af1c22

Please sign in to comment.