@@ -631,6 +631,7 @@ int send_pack(struct send_pack_args *args,
error("atomic push failed for ref %s. status: %d",
ref->name, ref->status);
ret = ERROR_SEND_PACK_BAD_REF_STATUS;
+ packet_flush(out);
goto out;
}
/* else fallthrough */
@@ -280,7 +280,7 @@ test_expect_success 'atomic push reports (reject by non-ff)' '
test_cmp expect actual
'
-test_expect_failure 'atomic push reports exit code failure' '
+test_expect_success 'atomic push reports exit code failure' '
write_script receive-pack-wrapper <<-\EOF &&
git-receive-pack "$@"
exit 1
@@ -296,7 +296,7 @@ test_expect_failure 'atomic push reports exit code failure' '
test_cmp expect err
'
-test_expect_failure 'atomic push reports exit code failure with porcelain' '
+test_expect_success 'atomic push reports exit code failure with porcelain' '
write_script receive-pack-wrapper <<-\EOF &&
git-receive-pack "$@"
exit 1
@@ -928,15 +928,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_re
close(data->fd[1]);
close(data->fd[0]);
- /*
- * Atomic push may abort the connection early and close the pipe,
- * which may cause an error for `finish_connect()`. Ignore this error
- * for atomic git-push.
- */
- if (ret || args.atomic)
- finish_connect(data->conn);
- else
- ret = finish_connect(data->conn);
+ ret |= finish_connect(data->conn);
data->conn = NULL;
data->finished_handshake = 0;