Merge branch 'es/local-atomic-push-failure-with-http' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Jul 2019 19:38:16 +0000 (12:38 -0700)
"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

1  2 
transport-helper.c
diff --combined transport-helper.c
index c7e17ec9cb61e6782bc255e6b90381054255c269,b11abd291cd22562217ed167107b7eb59414d9a8..6b05a88faf59ee74840b0f9fa340a5d9397a0f5d
@@@ -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;
                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: