From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-b4-smtp.messagingengine.com (fout-b4-smtp.messagingengine.com [202.12.124.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 856813B7B7B for ; Fri, 4 Sep 2026 05:21:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.147 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499298; cv=none; b=hupkdGS0B06S17bla4zbZ7esNx2iUlxBkRGiJA3IgiO1H/MkZWawAtsnkzMhk9dzXNF05UsiKfyXYDYSUoxRo5BuXFuc7Ha0lVDdtRxkFV0DYk/b13QkV6B3kmGxIFEAWCfcCM037Y6uSnpUUb5/4AkMqJfuTPihASCTUgSiGbM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788499298; c=relaxed/simple; bh=Zz4ltyPCy1zJd6h55rbqqevs9HBIS08jrXIVvhTT4lY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Tl8u/en+BT0n7ExNTU1iXK/i9uInHFb0/7iJ4hrpVAT+L3ay2iLcRDFTKgdDHz3CxD/oT6gxEoi5/JH+JpRU38grRzmHDrUpkN0mhD6kzhwBEQG40bpnBz/hfqCLJbJVh75MeZirswgEsWc5aIMEXaNypr2lUHJ6MLz9qySjl/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=RHSEcyAH; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=wmzHAVZo; arc=none smtp.client-ip=202.12.124.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="RHSEcyAH"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="wmzHAVZo" Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id CB5081D000D8; Fri, 4 Sep 2026 01:21:35 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 04 Sep 2026 01:21:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1788499295; x=1788585695; bh=IxJiCX+9TR lQaDWT6g8YwYFFvdvxKvfvX/bvCF+H3uk=; b=RHSEcyAHvFX3ySkfbdnUu+kWFt H8lIw5P6SoVmXb69417CLfqk/Ft18EH5zv525TN2Zy/tv2Rr/enPiheGjkuJou6m /7TVKLY9S2RPBWVx4n/Bjha7ge+fJU2RtJ9HY0ZYFW+yWrZ8Pr1cKGt0tAZOquzz CpUznwuU4K2yUbGUD3ng954TCOA53SJI0Uli3Q+ONzqkOo0rGuVdb5pnhl85qTRf Jy3G/C4DOvPFJSOuIwnB4YajHFwM461AZnxyN4bRXbLK4+mFKieKXt7zs8/hvQ+i k0HxfKJfLzmDPbGcEhVOYQmYw3WbKSsTydo+vyUKBmX+2RzWHYhTu/wWUbGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1788499295; x=1788585695; bh=IxJiCX+9TRlQa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JANB60mxbyhtD2bsVEb2r+5g X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Sep 2026 01:21:34 -0400 (EDT) Received: by mail (OpenSMTPD) with ESMTPSA id e08a6b94 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 4 Sep 2026 05:21:34 +0000 (UTC) Date: Fri, 4 Sep 2026 07:21:25 +0200 From: Patrick Steinhardt To: Derrick Stolee Cc: git@vger.kernel.org, Thomas Bachem , Phillip Wood Subject: Re: [PATCH 2/2] builtin/maintenance: improve heuristic for "rerere gc" Message-ID: References: <20260903-b4-pks-maintenance-rerere-gc-heuristic-v1-0-9929c45a9788@pks.im> <20260903-b4-pks-maintenance-rerere-gc-heuristic-v1-2-9929c45a9788@pks.im> <2ca2b4db-1fd9-46e8-9385-260a12af43bb@gmail.com> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2ca2b4db-1fd9-46e8-9385-260a12af43bb@gmail.com> On Thu, Sep 03, 2026 at 10:19:33AM -0400, Derrick Stolee wrote: > On 9/3/2026 5:04 AM, Patrick Steinhardt wrote: > > diff --git a/builtin/gc.c b/builtin/gc.c > > index de2f9e7fed..9147418a61 100644 > > --- a/builtin/gc.c > > +++ b/builtin/gc.c > > @@ -396,31 +396,13 @@ static int maintenance_task_rerere_gc(struct maintenance_run_opts *opts UNUSED, > > > > static int rerere_gc_condition(struct gc_config *cfg UNUSED) > > { > > - struct strbuf path = STRBUF_INIT; > > - int should_gc = 0, limit = 1; > > - DIR *dir = NULL; > > + int limit = 512; > > > > repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit); > > + if (limit <= 0) > > + return limit < 0; > > This is cute, but works. It's logically equivalent to > > if (!limit) > return 0; > if (limit < 0) > return 1; > > which would map more directly to the two documented cases. It takes > the slightest amount of mental processing to connect the docs to > the format you have. This also existed in the preimage, but I agree it's harder to read than really necessary. Will improve while at it. > > + return rerere_gc_estimate(the_repository, limit) >= (size_t)limit; > > } > > I do like that this method is simpler in the builtin code in favor > of a method that has access to rerere internals. > > I do wonder if rerere_gc_estimate() should be > rerere_stale_above_limit() instead, as we are not using any callers > that care about the resulting number other than "is it at least limit?" Agreed, the current name isn't great. I'm somehow hestitant to use `rerere_stale_above_limit()` too, though. I'll adapt it to `rerere_gc_needed()` instead. Thanks for your review! Patrick