author | Pascal Volk <user@localhost.localdomain.org> |
Sun, 21 Nov 2021 22:04:40 +0000 | |
changeset 762 | 0147c0a9ce2b |
permissions | -rwxr-xr-x |
762
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
1 |
#!/bin/sh |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
2 |
# |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
3 |
# An example hook script to make use of push options. |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
4 |
# The example simply echoes all push options that start with 'echoback=' |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
5 |
# and rejects all pushes when the "reject" push option is used. |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
6 |
# |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
7 |
# To enable this hook, rename this file to "pre-receive". |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
8 |
|
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
9 |
if test -n "$GIT_PUSH_OPTION_COUNT" |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
10 |
then |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
11 |
i=0 |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
12 |
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
13 |
do |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
14 |
eval "value=\$GIT_PUSH_OPTION_$i" |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
15 |
case "$value" in |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
16 |
echoback=*) |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
17 |
echo "echo from the pre-receive-hook: ${value#*=}" >&2 |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
18 |
;; |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
19 |
reject) |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
20 |
exit 1 |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
21 |
esac |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
22 |
i=$((i + 1)) |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
23 |
done |
0147c0a9ce2b
Added a README and the files of the empty vmm.git
Pascal Volk <user@localhost.localdomain.org>
parents:
diff
changeset
|
24 |
fi |