t5411: test updates of remote-tracking branches
In order to test update of remote-tracking branches for special refs, add new "remote.origin.fetch" settings and test cases. Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jiang Xin committed
Aug 27, 2020 at 11:45 UTC
c6a6a01c4acae1ed4b8a61176e3346e90b298ddd
1 file changed
+48
t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh
+48
@@ -1,3 +1,18 @@
1
+test_expect_success "setup git config for remote-tracking of special refs" '
2
+ (
3
+ cd workbench &&
4
+ if ! git config --get-all remote.origin.fetch | grep refs/for/
5
+ then
6
+ git config --add remote.origin.fetch \
7
+ "+refs/for/*:refs/t/for/*" &&
8
+ git config --add remote.origin.fetch \
9
+ "+refs/pull/*:refs/t/pull/*" &&
10
+ git config --add remote.origin.fetch \
11
+ "+refs/changes/*:refs/t/changes/*"
12
+ fi
13
+ )
14
+'
15
+
16
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 1st rewrite, $PROTOCOL)" '
17
write_script "$upstream/hooks/proc-receive" <<-EOF
18
printf >&2 "# proc-receive hook\n"
@@ -58,6 +73,17 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
73
test_cmp expect actual
74
'
75
76
+test_expect_success "proc-receive: check remote-tracking #1 ($PROTOCOL)" '
77
+ git -C workbench show-ref |
78
+ grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
79
+ make_user_friendly_and_stable_output <out >actual &&
80
+ cat >expect <<-EOF &&
81
+ <COMMIT-A> refs/t/for/master/topic
82
+ EOF
83
+ test_cmp expect actual &&
84
+ git -C workbench update-ref -d refs/t/for/master/topic
85
+'
86
+
87
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 2nd rewrite, $PROTOCOL)" '
88
write_script "$upstream/hooks/proc-receive" <<-EOF
89
printf >&2 "# proc-receive hook\n"
@@ -120,6 +146,17 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
146
test_cmp expect actual
147
'
148
149
+test_expect_success "proc-receive: check remote-tracking #2 ($PROTOCOL)" '
150
+ git -C workbench show-ref |
151
+ grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
152
+ make_user_friendly_and_stable_output <out >actual &&
153
+ cat >expect <<-EOF &&
154
+ <COMMIT-A> refs/t/for/master/topic
155
+ EOF
156
+ test_cmp expect actual &&
157
+ git -C workbench update-ref -d refs/t/for/master/topic
158
+'
159
+
160
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, $PROTOCOL)" '
161
write_script "$upstream/hooks/proc-receive" <<-EOF
162
printf >&2 "# proc-receive hook\n"
@@ -167,3 +204,14 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
204
EOF
205
test_cmp expect actual
206
'
207
+
208
+test_expect_success "proc-receive: check remote-tracking #3 ($PROTOCOL)" '
209
+ git -C workbench show-ref |
210
+ grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
211
+ make_user_friendly_and_stable_output <out >actual &&
212
+ cat >expect <<-EOF &&
213
+ <COMMIT-A> refs/t/for/master/topic
214
+ EOF
215
+ test_cmp expect actual &&
216
+ git -C workbench update-ref -d refs/t/for/master/topic
217
+'