git-version.sh 267 Bytes
Newer Older
1 2 3 4
#!/bin/bash

if test -d ${GIT_DIR:-.git} -o -f .git
then
5 6
    git describe --match "v*" --dirty
    if [[ $? -eq 0 ]]; then
7
	git describe --match "v*" | cut -f1 -d'-' > version.txt
8 9 10 11
    else
	var=`cat version.txt`
	echo ${var}-dirty
    fi
12
else
13
    cat version.txt
14 15
fi