-
Notifications
You must be signed in to change notification settings - Fork 20
/
step-085.sh
47 lines (37 loc) · 1.37 KB
/
step-085.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
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# Test:
# Cli tool: manage ignore files
if ! sh /var/lib/githooks/install.sh; then
echo "! Failed to execute the install script"
exit 1
fi
mkdir -p /tmp/test085 && cd /tmp/test085 || exit 1
! git hooks ignore test || exit 2
git init || exit 3
! git hooks ignore || exit 4
! git hooks ignore pre-commit || exit 5
git hooks ignore test-root &&
[ -f ".githooks/.ignore" ] &&
grep -q "test-root" ".githooks/.ignore" || exit 6
git hooks ignore test-second &&
[ -f ".githooks/.ignore" ] &&
grep -q "test-root" ".githooks/.ignore" &&
grep -q "test-second" ".githooks/.ignore" || exit 7
git hooks ignore pre-commit test-pc &&
[ -f ".githooks/pre-commit/.ignore" ] &&
grep -q "test-pc" ".githooks/pre-commit/.ignore" || exit 7
mkdir -p ".githooks/post-commit/.ignore" &&
! git hooks ignore post-commit test-fail &&
[ ! -f ".githooks/post-commit/.ignore" ] || exit 8
rm -rf .githooks
# Check the Git alias
git hooks ignore test-root &&
[ -f ".githooks/.ignore" ] &&
grep -q "test-root" ".githooks/.ignore" || exit 9
git hooks ignore test-second &&
[ -f ".githooks/.ignore" ] &&
grep -q "test-root" ".githooks/.ignore" &&
grep -q "test-second" ".githooks/.ignore" || exit 10
git hooks ignore pre-commit test-pc &&
[ -f ".githooks/pre-commit/.ignore" ] &&
grep -q "test-pc" ".githooks/pre-commit/.ignore" || exit 11