Skip to content

Commit c6a6a01

Browse files
jiangxingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 31e8595 commit c6a6a01

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

t/t5411/test-0036-report-multi-rewrite-for-one-ref.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
116
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 1st rewrite, $PROTOCOL)" '
217
write_script "$upstream/hooks/proc-receive" <<-EOF
318
printf >&2 "# proc-receive hook\n"
@@ -58,6 +73,17 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
5873
test_cmp expect actual
5974
'
6075

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+
6187
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 2nd rewrite, $PROTOCOL)" '
6288
write_script "$upstream/hooks/proc-receive" <<-EOF
6389
printf >&2 "# proc-receive hook\n"
@@ -120,6 +146,17 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
120146
test_cmp expect actual
121147
'
122148

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+
123160
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, $PROTOCOL)" '
124161
write_script "$upstream/hooks/proc-receive" <<-EOF
125162
printf >&2 "# proc-receive hook\n"
@@ -167,3 +204,14 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
167204
EOF
168205
test_cmp expect actual
169206
'
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+
'

0 commit comments

Comments
 (0)