diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-04-28 15:50:04 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-28 15:50:04 -0700 |
commit | 5b6864ca445e606bdd6dae607d3ee5f410da66fa (patch) | |
tree | 678130275ab282b480468163def1419fa42eb76b /transport-helper.c | |
parent | Merge branch 'jt/avoid-prefetch-when-able-in-diff' (diff) | |
parent | transport-helper: new method reject_atomic_push() (diff) | |
download | tgif-5b6864ca445e606bdd6dae607d3ee5f410da66fa.tar.xz |
Merge branch 'jx/atomic-push'
"git push --atomic" used to show failures for refs that weren't
even pushed, which has been corrected.
* jx/atomic-push:
transport-helper: new method reject_atomic_push()
transport-helper: mark failure for atomic push
send-pack: mark failure of atomic push properly
t5543: never report what we do not push
send-pack: fix inconsistent porcelain output
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c index 20a7185ec4..a46afcb69d 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -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; +} |