File: git-version.sh

package info (click to toggle)
autojump 20-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 336 kB
  • sloc: python: 482; sh: 363; xml: 81; makefile: 10
file content (20 lines) | stat: -rwxr-xr-x 472 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash
# add git revision to autojump

# Fail silently if there is no git directory, ie. if the user installed from a regular download
if [[ ! -d .git ]]
then
    exit
fi

if [ -z "$1" ]
then
    gitrevision=`git describe`
    if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
        gitrevision=$gitrevision"-dirty"
    fi
else
    gitrevision="$1"
fi

sed -i "s/^AUTOJUMP_VERSION = \".*\"$/AUTOJUMP_VERSION = \"$gitrevision\"/" autojump