diff options
author | Jiang Xin <zhiyou.jx@alibaba-inc.com> | 2020-04-17 12:45:36 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-04-17 22:16:32 +0300 |
commit | dfe1b7f19c04fd10e9bafce91bc1da0c18bbb194 (patch) | |
tree | 4f71c2429249967f3c5fe3305b7d26e4a1026e23 /send-pack.c | |
parent | f38b16843dcbb575803dfeab39a4172b7469411d (diff) |
transport-helper: new method reject_atomic_push()
Add new method in transport-helper to reject all references if any
reference is failed for atomic push.
This method is reused in "send-pack.c" and "transport-helper.c", one for
SSH, git and file protocols, and the other for HTTP protocol.
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'send-pack.c')
-rw-r--r-- | send-pack.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/send-pack.c b/send-pack.c index efefb687b2..a7c53193c9 100644 --- a/send-pack.c +++ b/send-pack.c @@ -320,31 +320,6 @@ free_return: return update_seen; } - -static int atomic_push_failure(struct send_pack_args *args, - struct ref *remote_refs, - struct ref *failing_ref) -{ - struct ref *ref; - /* Mark other refs as failed */ - for (ref = remote_refs; ref; ref = ref->next) { - if (!ref->peer_ref && !args->send_mirror) - 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 error("atomic push failed for ref %s. status: %d\n", - failing_ref->name, failing_ref->status); -} - #define NONCE_LEN_LIMIT 256 static void reject_invalid_nonce(const char *nonce, int len) @@ -489,7 +464,9 @@ int send_pack(struct send_pack_args *args, if (use_atomic) { strbuf_release(&req_buf); strbuf_release(&cap_buf); - atomic_push_failure(args, remote_refs, ref); + reject_atomic_push(remote_refs, args->send_mirror); + error("atomic push failed for ref %s. status: %d\n", + ref->name, ref->status); return args->porcelain ? 0 : -1; } /* else fallthrough */ |