-
Notifications
You must be signed in to change notification settings - Fork 20
/
step-021.sh
36 lines (28 loc) · 928 Bytes
/
step-021.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
28
29
30
31
32
33
34
35
36
#!/bin/sh
# Test:
# Set up local repos, run the install and verify the hooks get installed (home directory)
if echo "$EXTRA_INSTALL_ARGS" | grep -q "use-core-hookspath"; then
echo "Using core.hooksPath"
exit 249
fi
mkdir -p ~/test021/p001 && mkdir -p ~/test021/p002 || exit 1
cd ~/test021/p001 && git init || exit 1
cd ~/test021/p002 && git init || exit 1
if grep -r 'github.com/rycus86/githooks' ~/test021/; then
echo "! Hooks were installed ahead of time"
exit 1
fi
# run the install, and select installing the hooks into existing repos
echo 'n
y
~/test021
' | sh /var/lib/githooks/install.sh || exit 1
if ! grep -r 'github.com/rycus86/githooks' ~/test021/p001/.git/hooks; then
echo "! Hooks were not installed successfully"
exit 1
fi
if ! grep -r 'github.com/rycus86/githooks' ~/test021/p002/.git/hooks; then
echo "! Hooks were not installed successfully"
exit 1
fi
rm -rf ~/test021