From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 310961F619 for ; Thu, 12 Mar 2020 21:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbgCLV0P (ORCPT ); Thu, 12 Mar 2020 17:26:15 -0400 Received: from cloud.peff.net ([104.130.231.41]:38390 "HELO cloud.peff.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726491AbgCLV0P (ORCPT ); Thu, 12 Mar 2020 17:26:15 -0400 Received: (qmail 14684 invoked by uid 109); 12 Mar 2020 21:26:15 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with SMTP; Thu, 12 Mar 2020 21:26:15 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 2391 invoked by uid 111); 12 Mar 2020 21:35:39 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Thu, 12 Mar 2020 17:35:39 -0400 Authentication-Results: peff.net; auth=none Date: Thu, 12 Mar 2020 17:26:13 -0400 From: Jeff King To: Junio C Hamano Cc: Derrick Stolee via GitGitGadget , git@vger.kernel.org, jonathantanmy@google.com, me@ttaylorr.com, Derrick Stolee Subject: Re: [PATCH] connected.c: reprepare packs for corner cases Message-ID: <20200312212613.GB872402@coredump.intra.peff.net> References: <20200312211638.GA872402@coredump.intra.peff.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200312211638.GA872402@coredump.intra.peff.net> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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,