/
updateSCCSVersions
executable file
·33 lines (31 loc) · 1.11 KB
/
updateSCCSVersions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh -e
# checkin script for Git that serves to cause
# platforms/Cross/vm/sqSCCSVersion.h to be checked-in so that its version
# info reflects that of the current check-in.
WRKDIR=$(dirname $0)
if [ -d $WRKDIR/../.git ]; then
mkdir -p $WRKDIR/../.git/hooks/
cp -f $0 $WRKDIR/../.git/hooks/post-commit
cp -f $0 $WRKDIR/../.git/hooks/post-merge
cp -f $0 $WRKDIR/../.git/hooks/post-checkout
cd $WRKDIR/..
else
cd $WRKDIR/../..
if [ "$(basename $0)" = "post-checkout" ]; then
prevHEAD=$1
newHEAD=$2
branchChange=$3
if [ "$branchChange" = "0" ] && [ "$prevHEAD" = "$newHEAD" ]; then
# we did not switch branches and did not move to a new head (e.g. we
# just did a checkout on a file
exit 0
fi
fi
fi
git config --local include.path ../.gitconfig
git stash -q || true
echo "//" >> platforms/Cross/vm/sqSCCSVersion.h
echo "//" >> platforms/Cross/plugins/sqPluginsSCCSVersion.h
git checkout HEAD -- platforms/Cross/vm/sqSCCSVersion.h
git checkout HEAD -- platforms/Cross/plugins/sqPluginsSCCSVersion.h
git stash pop -q || true