Show 19 quoted lines
> Currently "git fetch REMOTE SHA1" silently exits 1 if the server doesn't
> allow requests for unadvertised objects by sha1. The more common case
> of requesting a nonexistent ref normally triggers a die() in
> get_fetch_map, so "git fetch" wasn't bothering to check after the fetch
> that it got all the refs it sought, like "git fetch-pack" does near the
> end of cmd_fetch_pack.
>
> Move the code from cmd_fetch_pack to a new function,
> report_unmatched_refs, that is called by fetch_refs_via_pack as part of
> "git fetch". Also, change filter_refs (which checks whether a request
> for an unadvertised object should be sent to the server) to set a new
> match status on the "struct ref" when the request is not allowed, and
> have report_unmatched_refs check for this status and print a special
> error message, "Server does not allow request for unadvertised object".
>
> Finally, add a simple test case for "git fetch REMOTE SHA1".
>
> Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
> ---
Hmph, I would have expected this to be done as a three-patch series,
* move the loop at the end of cmd_fetch_pack() to a separate helper
function report_unmatched_refs() and call it;
* add a call to report_unmatched_refs() to the transport layer;
* enhance report_unmatched_refs() by introducing match_status
field and adding new code to filter_refs() to diagnose other
kinds of errors.
The result looks reasonable from a cursory read, though.
Thanks for following it up to the completion.