-
Notifications
You must be signed in to change notification settings - Fork 20
/
step-074.sh
36 lines (29 loc) · 847 Bytes
/
step-074.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:
# Cli tool: list pending changes
if ! sh /var/lib/githooks/install.sh; then
echo "! Failed to execute the install script"
exit 1
fi
mkdir -p /tmp/test074/.githooks/pre-commit &&
echo 'echo "Hello"' >/tmp/test074/.githooks/pre-commit/testing &&
cd /tmp/test074 &&
git init ||
exit 1
if ! git hooks list pre-commit | grep 'pending / new'; then
echo "! Unexpected list result (1)"
exit 1
fi
if ! git hooks accept pre-commit testing; then
echo "! Failed to accept the hook"
exit 1
fi
if ! git hooks list pre-commit | grep 'active'; then
echo "! Unexpected list result (2)"
exit 1
fi
echo 'echo "Changed"' >/tmp/test074/.githooks/pre-commit/testing || exit 1
if ! git hooks list pre-commit | grep 'pending / changed'; then
echo "! Unexpected list result (3)"
exit 1
fi