mirror of
https://github.com/git/git.git
synced 2024-11-30 13:33:44 +08:00
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>
This commit is contained in:
parent
31e8595a11
commit
c6a6a01c4a
@ -1,3 +1,18 @@
|
||||
test_expect_success "setup git config for remote-tracking of special refs" '
|
||||
(
|
||||
cd workbench &&
|
||||
if ! git config --get-all remote.origin.fetch | grep refs/for/
|
||||
then
|
||||
git config --add remote.origin.fetch \
|
||||
"+refs/for/*:refs/t/for/*" &&
|
||||
git config --add remote.origin.fetch \
|
||||
"+refs/pull/*:refs/t/pull/*" &&
|
||||
git config --add remote.origin.fetch \
|
||||
"+refs/changes/*:refs/t/changes/*"
|
||||
fi
|
||||
)
|
||||
'
|
||||
|
||||
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 1st rewrite, $PROTOCOL)" '
|
||||
write_script "$upstream/hooks/proc-receive" <<-EOF
|
||||
printf >&2 "# proc-receive hook\n"
|
||||
@ -58,6 +73,17 @@ test_expect_success "proc-receive: multiple rewrite for one ref, no refname for
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success "proc-receive: check remote-tracking #1 ($PROTOCOL)" '
|
||||
git -C workbench show-ref |
|
||||
grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
<COMMIT-A> refs/t/for/master/topic
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
git -C workbench update-ref -d refs/t/for/master/topic
|
||||
'
|
||||
|
||||
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, no refname for the 2nd rewrite, $PROTOCOL)" '
|
||||
write_script "$upstream/hooks/proc-receive" <<-EOF
|
||||
printf >&2 "# proc-receive hook\n"
|
||||
@ -120,6 +146,17 @@ test_expect_success "proc-receive: multiple rewrites for one ref, no refname for
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success "proc-receive: check remote-tracking #2 ($PROTOCOL)" '
|
||||
git -C workbench show-ref |
|
||||
grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
<COMMIT-A> refs/t/for/master/topic
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
git -C workbench update-ref -d refs/t/for/master/topic
|
||||
'
|
||||
|
||||
test_expect_success "setup proc-receive hook (multiple rewrites for one ref, $PROTOCOL)" '
|
||||
write_script "$upstream/hooks/proc-receive" <<-EOF
|
||||
printf >&2 "# proc-receive hook\n"
|
||||
@ -167,3 +204,14 @@ test_expect_success "proc-receive: multiple rewrites for one ref ($PROTOCOL)" '
|
||||
EOF
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success "proc-receive: check remote-tracking #3 ($PROTOCOL)" '
|
||||
git -C workbench show-ref |
|
||||
grep -v -e refs/remotes -e refs/heads -e refs/tags >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
<COMMIT-A> refs/t/for/master/topic
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
git -C workbench update-ref -d refs/t/for/master/topic
|
||||
'
|
||||
|
Loading…
Reference in New Issue
Block a user