blob 754ad8eb93ed76021a51e2d6f65bda00afdf0db9 2739 bytes (raw)
name: t/t5571-pre-push-hook.sh # note: path name is non-authoritative(*)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
| | #!/bin/sh
test_description='check pre-push hooks'
. ./test-lib.sh
. "$TEST_DIRECTORY/lib-hooks.sh"
# Setup hook that always succeeds
HOOKDIR="$(git rev-parse --git-dir)/hooks"
HOOK="$HOOKDIR/pre-push"
mkdir -p "$HOOKDIR"
write_script "$HOOK" <<EOF
cat >/dev/null
exit 0
EOF
test_expect_success 'setup' '
git config push.default upstream &&
git init --bare repo1 &&
git remote add parent1 repo1 &&
test_commit one &&
git push parent1 HEAD:foreign
'
write_script "$HOOK" <<EOF
cat >/dev/null
exit 1
EOF
COMMIT1="$(git rev-parse HEAD)"
export COMMIT1
test_expect_success 'push with failing hook' '
test_commit two &&
test_must_fail git push parent1 HEAD
'
test_expect_success '--no-verify bypasses hook' '
git push --no-verify parent1 HEAD
'
COMMIT2="$(git rev-parse HEAD)"
export COMMIT2
write_script "$HOOK" <<'EOF'
echo "$1" >actual
echo "$2" >>actual
cat >>actual
EOF
cat >expected <<EOF
parent1
repo1
refs/heads/master $COMMIT2 refs/heads/foreign $COMMIT1
EOF
test_expect_success 'push with hook' '
git push parent1 master:foreign &&
diff expected actual
'
test_expect_success 'add a branch' '
git checkout -b other parent1/foreign &&
test_commit three
'
COMMIT3="$(git rev-parse HEAD)"
export COMMIT3
cat >expected <<EOF
parent1
repo1
refs/heads/other $COMMIT3 refs/heads/foreign $COMMIT2
EOF
test_expect_success 'push to default' '
git push &&
diff expected actual
'
cat >expected <<EOF
parent1
repo1
refs/tags/one $COMMIT1 refs/tags/tag1 $ZERO_OID
HEAD~ $COMMIT2 refs/heads/prev $ZERO_OID
EOF
test_expect_success 'push non-branches' '
git push parent1 one:tag1 HEAD~:refs/heads/prev &&
diff expected actual
'
cat >expected <<EOF
parent1
repo1
(delete) $ZERO_OID refs/heads/prev $COMMIT2
EOF
test_expect_success 'push delete' '
git push parent1 :prev &&
diff expected actual
'
cat >expected <<EOF
repo1
repo1
HEAD $COMMIT3 refs/heads/other $ZERO_OID
EOF
test_expect_success 'push to URL' '
git push repo1 HEAD &&
diff expected actual
'
test_expect_success 'set up many-ref tests' '
{
nr=1000
while test $nr -lt 2000
do
nr=$(( $nr + 1 ))
echo "create refs/heads/b/$nr $COMMIT3"
done
} | git update-ref --stdin
'
test_expect_success 'sigpipe does not cause pre-push hook failure' '
echo "exit 0" | write_script "$HOOK" &&
git push parent1 "refs/heads/b/*:refs/heads/b/*"
'
push_command () {
test_commit "$1" &&
git push hooks refs/heads/master:refs/heads/master
}
push_no_verify_command () {
test_commit "$1" &&
git push --no-verify hooks refs/heads/master:refs/heads/master
}
test_expect_success 'setup' '
git checkout master &&
git init --bare hooktest &&
git remote add hooks hooktest
'
test_multiple_hooks pre-push push_command push_no_verify_command
test_done
|
debug log:
solving 754ad8eb93 ...
found 754ad8eb93 in https://public-inbox.org/git/20190514002332.121089-7-sandals@crustytoothpaste.net/ ||
https://public-inbox.org/git/20190424004948.728326-6-sandals@crustytoothpaste.net/
found ac53d63869 in https://80x24.org/mirrors/git.git
preparing index
index prepared:
100755 ac53d638695b69b67e18832846be8105864367de t/t5571-pre-push-hook.sh
applying [1/1] https://public-inbox.org/git/20190514002332.121089-7-sandals@crustytoothpaste.net/
diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index ac53d63869..754ad8eb93 100755
Checking patch t/t5571-pre-push-hook.sh...
Applied patch t/t5571-pre-push-hook.sh cleanly.
skipping https://public-inbox.org/git/20190424004948.728326-6-sandals@crustytoothpaste.net/ for 754ad8eb93
index at:
100755 754ad8eb93ed76021a51e2d6f65bda00afdf0db9 t/t5571-pre-push-hook.sh
(*) Git path names are given by the tree(s) the blob belongs to.
Blobs themselves have no identifier aside from the hash of its contents.^
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).