forked from MicrosoftDocs/azure-devops-docs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·27 lines (21 loc) · 849 Bytes
/
install.sh
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
#!/bin/sh
GitRoot=$(git rev-parse --show-toplevel)
GitCommitMessageHookPath="$GitRoot/.git/hooks/commit-msg"
NewCommitMessageHookFile="/hooks/commit-msg"
NewCommitMessageHookPath="$GitRoot/tools/$NewCommitMessageHookFile"
if [ ! -e $NewCommitMessageHookPath ]; then
echo "Something's gone wrong, I can't find $NewCommitMessageHookPath"
exit 1
fi
echo "Installing Git commit-msg hook..."
if [ -e $GitCommitMessageHookPath ]; then
BackedUpCommitMessageHook="$GitCommitMessageHookPath.previous"
echo "You already have a Git commit-msg hook installed."
echo "Backing it up as $BackedUpCommitMessageHook"
if [ -e $BackedUpCommitMessageHook ]; then
rm $BackedUpCommitMessageHook
fi
mv $GitCommitMessageHookPath $BackedUpCommitMessageHook
fi
cp $NewCommitMessageHookPath $GitCommitMessageHookPath
echo "Done."