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
|
|
|
|
if [[ ! -d .git ]]
|
|
|
|
then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2011-11-18 13:25:54 +00:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
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
|
|
|
|
2011-09-24 09:45:47 +00:00
|
|
|
sed -i "s/^AUTOJUMP_VERSION = \".*\"$/AUTOJUMP_VERSION = \"$gitrevision\"/" autojump
|