summaryrefslogtreecommitdiffstats
path: root/printHash.sh
blob: 7b4453a10d78a90b19c262d8b4348a608ee5bd51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/bash

> $1

echo -n "#define GIT_SHA1 \"" > $1

git --version 2>&1 >/dev/null
GIT_IS_AVAILABLE=$?
if [ $GIT_IS_AVAILABLE -ne 0 ]; then
git rev-parse --short HEAD | tr -d '\n' >> $1
fi

echo "\"" >> $1
echo "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1