Skip to content

Commit c5c3486

Browse files
peffgitster
authored andcommitted
transport-helper: recognize "expecting report" error from send-pack
When a transport helper pushes via send-pack, it passes --helper-status to get a machine-readable status back for each ref. The previous commit taught the send-pack code to hand back "error expecting report" if the server did not send us the proper ref-status. And that's enough to cause us to recognize that an error occurred for the ref and print something sensible in our final status table. But we do interpret these messages on the remote-helper side to turn them back into REF_STATUS_* enum values. Recognizing this token to turn it back into REF_STATUS_EXPECTING_REPORT has two advantages: 1. We now print exactly the same message in the human-readable (and machine-readable --porcelain) output for this situation whether the transport went through a helper (e.g., http) or not (e.g., ssh). 2. If any code in the helper really cares about distinguishing EXPECT_REPORT from more generic error conditions, it could now do so. I didn't find any, so this is mostly future-proofing. So this is mostly cosmetic for now, but it seems like the least-surprising thing for the transport-helper code to be doing. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e4c9538 commit c5c3486

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

t/t5541-http-push-smart.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ test_expect_success 'report error server does not provide ref status' '
519519
rev-parse --verify refs/tags/will-fail &&
520520
cat >expect <<-EOF &&
521521
To $HTTPD_URL/smart/no_report
522-
! HEAD:refs/tags/will-fail [remote rejected] (expecting report)
522+
! HEAD:refs/tags/will-fail [remote failure] (remote failed to report status)
523523
Done
524524
EOF
525525
test_cmp expect actual

transport-helper.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,10 @@ static int push_update_ref_status(struct strbuf *buf,
845845
forced = 1;
846846
FREE_AND_NULL(msg);
847847
}
848+
else if (!strcmp(msg, "expecting report")) {
849+
status = REF_STATUS_EXPECTING_REPORT;
850+
FREE_AND_NULL(msg);
851+
}
848852
}
849853

850854
if (state->hint)

0 commit comments

Comments
 (0)