From: Junio C Hamano Date: Mon, 29 Jul 2019 19:38:16 +0000 (-0700) Subject: Merge branch 'es/local-atomic-push-failure-with-http' into maint X-Git-Tag: v2.23.0-rc0~1^2~20 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1a27b78e34e9d9685f6bd55e80b8199f4874ad11?hp=-c Merge branch 'es/local-atomic-push-failure-with-http' into maint "git push --atomic" that goes over the transport-helper (namely, the smart http transport) failed to prevent refs to be pushed when it can locally tell that one of the ref update will fail without having to consult the other end, which has been corrected. * es/local-atomic-push-failure-with-http: transport-helper: avoid var decl in for () loop control transport-helper: enforce atomic in push_refs_with_push --- 1a27b78e34e9d9685f6bd55e80b8199f4874ad11 diff --combined transport-helper.c index c7e17ec9cb,b11abd291c..6b05a88faf --- a/transport-helper.c +++ b/transport-helper.c @@@ -423,7 -423,7 +423,7 @@@ static int get_importer(struct transpor struct helper_data *data = transport->data; int cat_blob_fd, code; child_process_init(fastimport); - fastimport->in = helper->out; + fastimport->in = xdup(helper->out); argv_array_push(&fastimport->args, "fast-import"); argv_array_push(&fastimport->args, debug ? "--stats" : "--quiet"); @@@ -853,6 -853,7 +853,7 @@@ static int push_refs_with_push(struct t { int force_all = flags & TRANSPORT_PUSH_FORCE; int mirror = flags & TRANSPORT_PUSH_MIRROR; + int atomic = flags & TRANSPORT_PUSH_ATOMIC; struct helper_data *data = transport->data; struct strbuf buf = STRBUF_INIT; struct ref *ref; @@@ -872,6 -873,11 +873,11 @@@ case REF_STATUS_REJECT_NONFASTFORWARD: case REF_STATUS_REJECT_STALE: case REF_STATUS_REJECT_ALREADY_EXISTS: + if (atomic) { + string_list_clear(&cas_options, 0); + return 0; + } else + continue; case REF_STATUS_UPTODATE: continue; default: