2010-08-28 05:59:27 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ -f ${1}/.version ]; then
|
2013-06-04 22:56:05 +08:00
|
|
|
cat ${1}/.version
|
2010-09-30 05:21:45 +08:00
|
|
|
elif [ -d ${1}/.git ]; then
|
2015-04-16 22:37:22 +08:00
|
|
|
VERSION=`git describe --tags --dirty=M 2> /dev/null | sed -e "s/^v\([0-9]\)/\1/"`
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
MODIFIED=""
|
2010-09-25 06:44:41 +08:00
|
|
|
if [ "`git ls-files -m | wc -l`" != "0" ]; then
|
2010-09-22 03:26:17 +08:00
|
|
|
MODIFIED="M"
|
|
|
|
fi
|
2015-04-16 22:37:22 +08:00
|
|
|
# Some older versions of git do not support all the above
|
|
|
|
# options.
|
|
|
|
VERSION=GIT-`git rev-parse --short --verify HEAD`${MODIFIED}
|
2010-09-22 03:26:17 +08:00
|
|
|
fi
|
2015-04-16 22:37:22 +08:00
|
|
|
echo ${VERSION}
|
2013-01-26 02:54:18 +08:00
|
|
|
else
|
|
|
|
# Use the directory information in the absence of any other version
|
|
|
|
# information
|
|
|
|
pwd -P
|
2010-08-28 05:59:27 +08:00
|
|
|
fi
|