2011-09-16 06:21:35 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# add git revision to autojump
|
2011-09-24 09:54:40 +00:00
|
|
|
|
|
|
|
# Fail silently if there is no git directory, ie. if the user installed from a regular download
|
2012-04-17 23:09:39 +00:00
|
|
|
if [[ ! -d .git ]]; then
|
2011-09-24 09:54:40 +00:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2012-04-17 23:09:39 +00:00
|
|
|
if [ -z "$1" ]; then
|
2011-11-18 13:25:54 +00:00
|
|
|
gitrevision=`git describe`
|
|
|
|
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
|
|
|
|
gitrevision=$gitrevision"-dirty"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
gitrevision="$1"
|
2011-09-16 06:21:35 +00:00
|
|
|
fi
|
2011-11-18 13:25:54 +00:00
|
|
|
|
2012-05-07 06:50:40 +00:00
|
|
|
sed -i "s/^VERSION = \".*\"$/VERSION = \"$gitrevision\"/" ./bin/autojump
|