t5411: use different out file to prevent overwriting
SZEDER reported that t5411 failed in Travis CI's s390x environment a couple of times, and could be reproduced with '--stress' test on this specific environment. The test failure messages might look like this: + test_cmp expect actual --- expect 2021-01-17 21:55:23.430750004 +0000 +++ actual 2021-01-17 21:55:23.430750004 +0000 @@ -1 +1 @@ -<COMMIT-A> refs/heads/main +<COMMIT-A> refs/heads/maifatal: the remote end hung up unexpectedly error: last command exited with $?=1 not ok 86 - proc-receive: not support push options (builtin protocol) The file 'actual' is filtered from the file 'out' which contains result of 'git show-ref' command. Due to the error messages from other process is written into the file 'out' accidentally, t5411 failed. SZEDER finds the root cause of this issue: - 'git push' is executed with its standard output and error redirected to the file 'out'. - 'git push' executes 'git receive-pack' internally, which inherits the open file descriptors, so its output and error goes into that same 'out' file. - 'git push' ends without waiting for the close of 'git-receive-pack' for some cases, and the file 'out' is reused for test of 'git show-ref' afterwards. - A mixture of the output of 'git show-ref' abd 'git receive-pack' leads to this issue. The first intuitive reaction to resolve this issue is to remove the file 'out' after use, so that the newly created file 'out' will have a different file descriptor and will not be overwritten by the 'git receive-pack' process. But Johannes pointed out that removing an open file is not possible on Windows. So we use different temporary file names to store the output of 'git push' to solve this issue. Reported-by: SZEDER Gábor <szeder.dev@gmail.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Helped-by: SZEDER Gábor <szeder.dev@gmail.com> 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
71ca53e812
commit
8388a64cd1
@ -35,11 +35,11 @@ test_expect_success "git-push --atomic ($PROTOCOL)" '
|
||||
test_must_fail git -C workbench push --atomic origin \
|
||||
main \
|
||||
$B:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [rejected] main -> main (non-fast-forward)
|
||||
@ -65,8 +65,8 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL)" '
|
||||
push origin \
|
||||
main \
|
||||
$B:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
|
||||
|
@ -36,12 +36,12 @@ test_expect_success "git-push --atomic ($PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --atomic --porcelain origin \
|
||||
main \
|
||||
$B:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "s/^# GETTEXT POISON #//" \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! refs/heads/main:refs/heads/main [rejected] (non-fast-forward)
|
||||
@ -67,8 +67,8 @@ test_expect_success "non-fast-forward git-push ($PROTOCOL/porcelain)" '
|
||||
push --porcelain origin \
|
||||
main \
|
||||
$B:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/next
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "git-push is declined ($PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
$B:refs/heads/main \
|
||||
HEAD:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] <COMMIT-B> -> main (pre-receive hook declined)
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "git-push is declined ($PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
$B:refs/heads/main \
|
||||
HEAD:refs/heads/next \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! <COMMIT-B>:refs/heads/main [remote rejected] (pre-receive hook declined)
|
||||
|
@ -5,8 +5,8 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL)
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:next \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
|
||||
@ -41,8 +41,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
|
||||
test_must_fail git -C workbench push --atomic origin \
|
||||
$B:main \
|
||||
HEAD:next \
|
||||
HEAD:refs/for/main/topic >out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
@ -5,8 +5,8 @@ test_expect_success "proc-receive: no hook, fail to push special ref ($PROTOCOL/
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:next \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
|
||||
@ -42,8 +42,8 @@ test_expect_success "proc-receive: no hook, all failed for atomic push ($PROTOCO
|
||||
test_must_fail git -C workbench push --porcelain --atomic origin \
|
||||
$B:main \
|
||||
HEAD:next \
|
||||
HEAD:refs/for/main/topic >out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
@ -11,8 +11,8 @@ test_expect_success "setup proc-receive hook (unknown version, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
|
||||
# Check status report for git-push
|
||||
sed -n \
|
||||
@ -55,18 +55,18 @@ test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-read-version, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-version option" out &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out &&
|
||||
grep "remote: fatal: die with the --die-read-version option" out-$test_count &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -89,18 +89,18 @@ test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCO
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-write-version, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-write-version option" out &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out &&
|
||||
grep "remote: fatal: die with the --die-write-version option" out-$test_count &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -123,17 +123,17 @@ test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCO
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-read-commands, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-commands option" out &&
|
||||
grep "remote: fatal: die with the --die-read-commands option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -158,17 +158,17 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-push-options, $
|
||||
test_must_fail git -C workbench push origin \
|
||||
-o reviewers=user1,user2 \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-push-options option" out &&
|
||||
grep "remote: fatal: die with the --die-read-push-options option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -191,17 +191,17 @@ test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-write-report, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; }" \
|
||||
-e "/^ ! / { p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! [remote rejected] HEAD -> refs/for/main/topic (fail to run proc-receive hook)
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-write-report option" out &&
|
||||
grep "remote: fatal: die with the --die-write-report option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -224,8 +224,8 @@ test_expect_success "setup proc-receive hook (no report, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/heads/next \
|
||||
HEAD:refs/for/main/topic >out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
|
||||
@ -270,8 +270,8 @@ test_expect_success "setup proc-receive hook (no ref, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic\
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
@ -306,8 +306,8 @@ test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -11,8 +11,8 @@ test_expect_success "setup proc-receive hook (unknown version, $PROTOCOL/porcela
|
||||
test_expect_success "proc-receive: bad protocol (unknown version, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
|
||||
# Check status report for git-push
|
||||
sed -n \
|
||||
@ -55,18 +55,18 @@ test_expect_success "setup proc-receive hook (hook --die-read-version, $PROTOCOL
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-read-version, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; n; p; n; p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
|
||||
Done
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-version option" out &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out &&
|
||||
grep "remote: fatal: die with the --die-read-version option" out-$test_count &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -89,18 +89,18 @@ test_expect_success "setup proc-receive hook (hook --die-write-version, $PROTOCO
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-write-version, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; n; p; n; p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
|
||||
Done
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-write-version option" out &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out &&
|
||||
grep "remote: fatal: die with the --die-write-version option" out-$test_count &&
|
||||
grep "remote: error: fail to negotiate version with proc-receive hook" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -123,17 +123,17 @@ test_expect_success "setup proc-receive hook (hook --die-read-commands, $PROTOCO
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-read-commands, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; n; p; n; p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
|
||||
Done
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-commands option" out &&
|
||||
grep "remote: fatal: die with the --die-read-commands option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -158,17 +158,17 @@ test_expect_success "proc-receive: bad protocol (hook --die-read-push-options, $
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
-o reviewers=user1,user2 \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; n; p; n; p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
|
||||
Done
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-read-push-options option" out &&
|
||||
grep "remote: fatal: die with the --die-read-push-options option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -191,17 +191,17 @@ test_expect_success "setup proc-receive hook (hook --die-write-report, $PROTOCOL
|
||||
test_expect_success "proc-receive: bad protocol (hook --die-write-report, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
>out-$test_count 2>&1 &&
|
||||
filter_out_user_friendly_and_stable_output \
|
||||
-e "/^To / { p; n; p; n; p; }" \
|
||||
<out >actual &&
|
||||
<out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
To <URL/of/upstream.git>
|
||||
! HEAD:refs/for/main/topic [remote rejected] (fail to run proc-receive hook)
|
||||
Done
|
||||
EOF
|
||||
test_cmp expect actual &&
|
||||
grep "remote: fatal: die with the --die-write-report option" out &&
|
||||
grep "remote: fatal: die with the --die-write-report option" out-$test_count &&
|
||||
|
||||
git -C "$upstream" show-ref >out &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
@ -224,8 +224,8 @@ test_expect_success "setup proc-receive hook (no report, $PROTOCOL/porcelain)" '
|
||||
test_expect_success "proc-receive: bad protocol (no report, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/heads/next \
|
||||
HEAD:refs/for/main/topic >out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
HEAD:refs/for/main/topic >out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
|
||||
@ -270,8 +270,8 @@ test_expect_success "setup proc-receive hook (no ref, $PROTOCOL/porcelain)" '
|
||||
test_expect_success "proc-receive: bad protocol (no ref, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic\
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
@ -307,8 +307,8 @@ test_expect_success "setup proc-receive hook (unknown status, $PROTOCOL/porcelai
|
||||
test_expect_success "proc-receive: bad protocol (unknown status, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
@ -46,8 +46,8 @@ test_expect_success "setup proc-receive hook (ng message, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (ng, no message, $PROTOCOL/porcelai
|
||||
test_expect_success "proc-receive: fail to update (ng, no message, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
@ -47,8 +47,8 @@ test_expect_success "setup proc-receive hook (ng message, $PROTOCOL/porcelain)"
|
||||
test_expect_success "proc-receive: fail to update (ng, with message, $PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -13,8 +13,8 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
$B:refs/heads/main \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
@ -13,8 +13,8 @@ test_expect_success "proc-receive: report unexpected ref ($PROTOCOL/porcelain)"
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
$B:refs/heads/main \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (unexpected ref, $PROTOCOL)" '
|
||||
test_expect_success "proc-receive: report unknown reference ($PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/a/b/c/my/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
|
||||
|
@ -12,8 +12,8 @@ test_expect_success "setup proc-receive hook (unexpected ref, $PROTOCOL/porcelai
|
||||
test_expect_success "proc-receive: report unknown reference ($PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/a/b/c/my/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/a/b/c/my/topic
|
||||
|
@ -16,8 +16,8 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL)" '
|
||||
-o reviewer=user1 \
|
||||
origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
test_i18ngrep "fatal: the receiving end does not support push options" \
|
||||
actual &&
|
||||
git -C "$upstream" show-ref >out &&
|
||||
|
@ -17,8 +17,8 @@ test_expect_success "proc-receive: not support push options ($PROTOCOL/porcelain
|
||||
-o reviewer=user1 \
|
||||
origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
test_i18ngrep "fatal: the receiving end does not support push options" \
|
||||
actual &&
|
||||
git -C "$upstream" show-ref >out &&
|
||||
|
@ -13,8 +13,8 @@ test_expect_success "setup proc-receive hook (option without matching ok, $PROTO
|
||||
test_expect_success "proc-receive: report option without matching ok ($PROTOCOL)" '
|
||||
test_must_fail git -C workbench push origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -13,8 +13,8 @@ test_expect_success "setup proc-receive hook (option without matching ok, $PROTO
|
||||
test_expect_success "proc-receive: report option without matching ok ($PROTOCOL/porcelain)" '
|
||||
test_must_fail git -C workbench push --porcelain origin \
|
||||
HEAD:refs/for/main/topic \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/main/topic
|
||||
|
@ -24,8 +24,8 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL)" '
|
||||
HEAD:refs/heads/foo \
|
||||
HEAD:refs/for/main/topic \
|
||||
HEAD:refs/for/next/topic3 \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
@ -24,8 +24,8 @@ test_expect_success "proc-receive: report update of mixed refs ($PROTOCOL/porcel
|
||||
HEAD:refs/heads/foo \
|
||||
HEAD:refs/for/main/topic \
|
||||
HEAD:refs/for/next/topic3 \
|
||||
>out 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out >actual &&
|
||||
>out-$test_count 2>&1 &&
|
||||
make_user_friendly_and_stable_output <out-$test_count >actual &&
|
||||
cat >expect <<-EOF &&
|
||||
remote: # pre-receive hook
|
||||
remote: pre-receive< <COMMIT-A> <COMMIT-B> refs/heads/main
|
||||
|
Loading…
Reference in New Issue
Block a user