summaryrefslogtreecommitdiff
path: root/t/t5411/test-0001-standard-git-push--porcelain.sh
diff options
context:
space:
mode:
authorLibravatar Jiang Xin <zhiyou.jx@alibaba-inc.com>2021-01-20 21:53:31 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-01-22 13:09:06 -0800
commit822ee894f621674610a36cc9a84a9ffbbb8fb6bb (patch)
tree70c3efa9e94bacf13970a1ae8681b4a24e155615 /t/t5411/test-0001-standard-git-push--porcelain.sh
parentt5411: use different out file to prevent overwriting (diff)
downloadtgif-822ee894f621674610a36cc9a84a9ffbbb8fb6bb.tar.xz
t5411: refactor check of refs using test_cmp_refs
Add new helper 'test_cmp_refs' to check references in a repository. Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5411/test-0001-standard-git-push--porcelain.sh')
-rw-r--r--t/t5411/test-0001-standard-git-push--porcelain.sh24
1 files changed, 8 insertions, 16 deletions
diff --git a/t/t5411/test-0001-standard-git-push--porcelain.sh b/t/t5411/test-0001-standard-git-push--porcelain.sh
index 59630ef7e5..bcbda72341 100644
--- a/t/t5411/test-0001-standard-git-push--porcelain.sh
+++ b/t/t5411/test-0001-standard-git-push--porcelain.sh
@@ -20,13 +20,11 @@ test_expect_success "git-push ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -48,13 +46,11 @@ test_expect_success "git-push --atomic ($PROTOCOL/porcelain)" '
! <COMMIT-B>:refs/heads/next [rejected] (atomic push failed)
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-A> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(A)
@@ -80,13 +76,11 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-B> refs/heads/main
<COMMIT-B> refs/heads/next
EOF
- test_cmp expect actual
'
# Refs of upstream : main(B) next(B)
@@ -123,15 +117,13 @@ test_expect_success "git-push -f ($PROTOCOL/porcelain)" '
Done
EOF
test_cmp expect actual &&
- git -C "$upstream" show-ref >out &&
- make_user_friendly_and_stable_output <out >actual &&
- cat >expect <<-EOF &&
+
+ test_cmp_refs -C "$upstream" <<-EOF
<COMMIT-A> refs/heads/a/b/c
<COMMIT-A> refs/heads/main
<COMMIT-A> refs/review/main/topic
<TAG-v123> refs/tags/v123
EOF
- test_cmp expect actual
'
# Refs of upstream : main(A) tags/v123 refs/review/main/topic(A) a/b/c(A)