]> git.ipfire.org Git - thirdparty/git.git/blobdiff - transport-helper.c
Merge branch 'es/trace-log-progress'
[thirdparty/git.git] / transport-helper.c
index 20a7185ec40e1cf4612c259019f325208632373b..a46afcb69db615d2f8917f852db28c3dca501de0 100644 (file)
@@ -894,6 +894,7 @@ static int push_refs_with_push(struct transport *transport,
                case REF_STATUS_REJECT_STALE:
                case REF_STATUS_REJECT_ALREADY_EXISTS:
                        if (atomic) {
+                               reject_atomic_push(remote_refs, mirror);
                                string_list_clear(&cas_options, 0);
                                return 0;
                        } else
@@ -1488,3 +1489,25 @@ int bidirectional_transfer_loop(int input, int output)
 
        return tloop_spawnwait_tasks(&state);
 }
+
+void reject_atomic_push(struct ref *remote_refs, int mirror_mode)
+{
+       struct ref *ref;
+
+       /* Mark other refs as failed */
+       for (ref = remote_refs; ref; ref = ref->next) {
+               if (!ref->peer_ref && !mirror_mode)
+                       continue;
+
+               switch (ref->status) {
+               case REF_STATUS_NONE:
+               case REF_STATUS_OK:
+               case REF_STATUS_EXPECTING_REPORT:
+                       ref->status = REF_STATUS_ATOMIC_PUSH_FAILED;
+                       continue;
+               default:
+                       break; /* do nothing */
+               }
+       }
+       return;
+}