-
Notifications
You must be signed in to change notification settings - Fork 20
/
step-058.sh
57 lines (46 loc) · 1.33 KB
/
step-058.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
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
# Test:
# Cli tool: accept changes to a hook
sh /var/lib/githooks/install.sh || exit 1
mkdir -p /tmp/test058/.githooks/pre-commit &&
echo 'echo "Hello"' >/tmp/test058/.githooks/pre-commit/first &&
echo 'echo "Hello"' >/tmp/test058/.githooks/pre-commit/second &&
cd /tmp/test058 &&
git init ||
exit 1
if ! git hooks list | grep "first" | grep -q "pending"; then
echo "! Unexpected cli list output (1)"
exit 1
fi
if ! git hooks list | grep "second" | grep -q "pending"; then
echo "! Unexpected cli list output (2)"
exit 1
fi
if ! git hooks accept pre-commit/first; then
echo "! Failed to accept a hook by relative path"
exit 1
fi
if ! git hooks list | grep "first" | grep -q "active"; then
echo "! Unexpected cli list output (3)"
exit 1
fi
if ! git hooks list | grep "second" | grep -q "pending"; then
echo "! Unexpected cli list output (4)"
exit 1
fi
if ! git hooks accept .; then
echo "! Failed to accept all hooks"
exit 1
fi
if ! git hooks list | grep "first" | grep -q "active"; then
echo "! Unexpected cli list output (5)"
exit 1
fi
if ! git hooks list | grep "second" | grep -q "active"; then
echo "! Unexpected cli list output (6)"
exit 1
fi
if ! git hooks accept || ! git hooks list; then
echo "! The Git alias integration failed"
exit 1
fi