On Thu, Mar 12, 2020 at 05:16:38PM -0400, Jeff King wrote: > There we see that same reprepare happen in 882839, which is the child > fetch-pack. The parent fetch probably needs to reprepare itself after > fetch-pack completes. Actually, it's not fetch which is running fetch-pack, but rather the remote helper itself. So I think the simplest thing is for the remote-helper layer to do something like this: diff --git a/transport-helper.c b/transport-helper.c index 20a7185ec4..25957e9a05 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -14,6 +14,7 @@ #include "refspec.h" #include "transport-internal.h" #include "protocol.h" +#include "packfile.h" static int debug; @@ -672,6 +673,7 @@ static int fetch(struct transport *transport, { struct helper_data *data = transport->data; int i, count; + int ret; get_helper(transport); @@ -710,13 +712,18 @@ static int fetch(struct transport *transport, if (data->transport_options.negotiation_tips) warning("Ignoring --negotiation-tip because the protocol does not support it."); - if (data->fetch) - return fetch_with_fetch(transport, nr_heads, to_fetch); + ret = data->fetch ? fetch_with_fetch(transport, nr_heads, to_fetch) : + data->import ? fetch_with_import(transport, nr_heads, to_fetch) : + -1; - if (data->import) - return fetch_with_import(transport, nr_heads, to_fetch); + /* + * We may have just received a pack through the helper sub-process; + * refresh the pack list. + */ + if (!ret) + reprepare_packed_git(the_repository); - return -1; + return ret; } static int push_update_ref_status(struct strbuf *buf,