mbox series

[0/3] Never report references we not push

Message ID 20200325143608.45141-1-zhiyou.jx@alibaba-inc.com (mailing list archive)
Headers show
Series Never report references we not push | expand

Message

Jiang Xin March 25, 2020, 2:36 p.m. UTC
A strange behavior is found when writing test cases for topic
'jx/proc-receive-hook':

> # TODO: report for the failure of master branch is unnecessary.
> test_expect_success "no proc-receive hook, fail all for atomic push" '
> 	(
> 		cd workbench &&
> 		test_must_fail git push --atomic origin \
> 			HEAD:next \
> 			HEAD:refs/for/master/topic
> 	) >out 2>&1 &&
> 	format_git_output <out >actual &&
> 	cat >expect <<-EOF &&
> 	remote: # pre-receive hook
> 	remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/heads/next
> 	remote: pre-receive< <ZERO-OID> <COMMIT-A> refs/for/master/topic
> 	remote: error: cannot to find hook "proc-receive"
> 	To ../upstream
> 	 ! [rejected]        master (atomic push failed)

We do not push "master" branch, but git reports status for it.

> 	 ! [remote rejected] HEAD -> next (fail to run proc-receive hook)
> 	 ! [remote rejected] HEAD -> refs/for/master/topic (fail to run proc-receive hook)
> 	error: failed to push some refs to "../upstream"
> 	EOF
> 	test_cmp expect actual &&
> 	(
> 		cd upstream &&
> 		git show-ref
> 	) >out &&
> 	format_git_output <out >actual &&
> 	cat >expect <<-EOF &&
> 	<COMMIT-A> refs/heads/master
> 	EOF
> 	test_cmp expect actual
> '

This issue is introduced by commit v2.22.0-1-g3bca1e7f9f (transport-helper:
enforce atomic in push_refs_with_push, 2019-07-11).  That commit wanted to
fix report issue of HTTP protocol, but marked all remote references failure
for atomic push.

--

Jiang Xin (3):
  t5543: never report what we do not push
  send-pack: mark failure of atomic push properly
  transport-helper: enforce atomic in push_refs_with_push

 send-pack.c                |  2 +
 t/t5541-http-push-smart.sh | 12 ++++-
 t/t5543-atomic-push.sh     | 92 ++++++++++++++++++++++++++++++++++++++
 transport-helper.c         | 15 +++++++
 transport.c                | 14 ------
 5 files changed, 119 insertions(+), 16 deletions(-)