aboutsummaryrefslogtreecommitdiff
path: root/scripts/git_hash.sh
blob: 6cfec2f363f0c2d1a68ad17001ddb296734d2c0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [ -z ${1} ]; then
	echo "should be called with a path"
	exit
fi
ROOTDIR=${1}

CUSTOM_STR=${CUSTOM_STR:-https://git.linaro.org/lng/odp.git}
if [ -d ${ROOTDIR}/.git ]; then
	hash=$(git describe | tr -d "\n")
	if git diff-index --name-only HEAD &>/dev/null ; then
		dirty=-dirty
	fi

	echo -n "'${CUSTOM_STR}' (${hash}${dirty})">${ROOTDIR}/.scmversion
fi

cat ${ROOTDIR}/.scmversion