summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJiang Xin <zhiyou.jx@alibaba-inc.com>2020-04-17 09:45:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-04-17 19:16:32 (GMT)
commitf38b16843dcbb575803dfeab39a4172b7469411d (patch)
treeb01a7e8275694f9c0c5e6d84dc79d62ed83d9ff7 /transport-helper.c
parent46701bde690f94fb1532bce110eae93d5f6b68a1 (diff)
downloadgit-f38b16843dcbb575803dfeab39a4172b7469411d.zip
git-f38b16843dcbb575803dfeab39a4172b7469411d.tar.gz
git-f38b16843dcbb575803dfeab39a4172b7469411d.tar.bz2
transport-helper: mark failure for atomic push
Commit v2.22.0-1-g3bca1e7f9f (transport-helper: enforce atomic in push_refs_with_push, 2019-07-11) noticed the incomplete report of failure of an atomic push for HTTP protocol. But the implementation has a flaw that mark all remote references as failure. Only mark necessary references as failure in `push_refs_with_push()` of transport-helper. Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/transport-helper.c b/transport-helper.c
index 20a7185..ab3b52e 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -894,6 +894,21 @@ static int push_refs_with_push(struct transport *transport,
case REF_STATUS_REJECT_STALE:
case REF_STATUS_REJECT_ALREADY_EXISTS:
if (atomic) {
+ /* Mark other refs as failed */
+ for (ref = remote_refs; ref; ref = ref->next) {
+ if (!ref->peer_ref && !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 */
+ }
+ }
string_list_clear(&cas_options, 0);
return 0;
} else