Article View: linux.kernel.git
Article #3185Re: [PATCH] read-cache: use istate->repo in overlay_tree_on_index()
From: Junio C Hamano
Date: Mon, 16 Nov 2026 16:51
Date: Mon, 16 Nov 2026 16:51
61 lines
14841 bytes
14841 bytes
Derrick Stolee <stolee@gmail.com> writes: > On 11/16/2026 5:34 AM, Srujith A Poojary via GitGitGadget wrote: >> From: Srujith A Poojary <poojarysrujith@gmail.com> >> >> Use the repository associated with the index state when >> resolving the tree name, parsing the tree, and reading >> its entries. >> >> This avoids relying on the global repository when the >> function already has access to its associated repository. > > Cleanups are good. At least this one is not making things any worse. But there are other functions in this file, like add_to_index() and refresh_index(), that take istate but still mention the_repository. Cleaning these functions that share the same issue together in a single patch would help us reduce the review load and patch churn. On the other hand, I do not think it is a good idea to try losing USE_THE_REPOSITORY from this file all at once. There are many lower-level functions that do not take istate (or repo), and it needs a design based on deeper thinking (which has not been made here for the obvious reason of not needing one yet) to decide what to do with them [*]. We do not want to see such changes in the same series of patches as a mechanical replacement patch like this one. Thanks. [Footnote] * Passing an extra parameter, either repo or istate, to these functions may be an easy way, but the overhead may make it a less-than-optimal solution, for example. Teaching ce which istate it belongs to is an absolute no-no, as these things are born without their own istate, and are transfered between different istates; besides they are so numerous. Those are merely one or two examples that need to be considered before we know what the right approach is. >> + struct repository *repo = istate->repo; > >> - if (repo_get_oid(the_repository, tree_name, &oid)) >> + if (repo_get_oid(repo, tree_name, &oid)) > >> - tree = repo_parse_tree_indirect(the_repository, &oid); >> + tree = repo_parse_tree_indirect(repo, &oid); > >> - err = read_tree(the_repository, tree, &pathspec, fn, istate); >> + err = read_tree(repo, tree, &pathspec, fn, istate); > The only other way to do this would be to replace the_repository > with 'istate->repo' directly, but having a 'repo' variable is > just as good. > > LGTM. > -Stolee
Technical Details
Message-ID:
<xmqqtslglnxk.fsf@gitster.g>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75550-linux-kernel-git=dewy.ruReferences:
<pull.2315.git.1794825269464.gitgitgadget@gmail.com> <b7abaeba-1dd9-45f3-ad63-e43c49ee48d4@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-75550-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] read-cache: use istate->repo in overlay_tree_on_index()
Date: Mon, 16 Nov 2026 08:51:35 -0800
Organization: Usenet Network
Message-ID: <xmqqtslglnxk.fsf@gitster.g>
References: <pull.2315.git.1794825269464.gitgitgadget@gmail.com>
<b7abaeba-1dd9-45f3-ad63-e43c49ee48d4@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="2116209"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gEAzVuV/MtjmTraubxLp/hK17/4= sha256:So3EhbWy7D5ThGV8T6wc6GKhF0Qx6ukcd6AEky5ZLDc=
sha1:RS/GmJ3bZQ0uF51hsD/lD4r8NFA= sha256:Wlq3c+B6/trm0ByPIkuhZcvUoApBOBE9PTVpDy4VSdc=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 0241E114D00; Mon, 16 Nov 2026 19:52:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.15
X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31
tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=pobox.com header.b=D2gWZqpr; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=sD5PqnWW
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id HEMbTzS5eKFF;
Mon, 16 Nov 2026 19:52:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-75550-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=pobox.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 7E079114CBC; Mon, 16 Nov 2026 19:51:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id A0C703160E; Mon, 16 Nov 2026 16:51:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794847899;
b=xkjYNQR2cax6/mXfhHCSSIX7VmUIELvUL/eWHb0hvh4ZUN5QZ76Z8UdzaNihpimbZkwz
HLIbFG/Mfp4De9/ZPSWFRbSFUI6SgzbUtcllx1RVbdkLawwEe55S3L51fHfjJKamv6mpB
8EUlIM3BiiCnUtf0KDoabQUIyd4Y5sMSZdtoCYSe5OqXh5wl5bVeqljl4S4kSh7itEP37
0Ey0RSejHC1Deh4211QmdHGmdCc8vl04TSNAhDrlg8kayfHl8/Y5p4GhBv12g/poF/tOk
XCTa5pqWwLKIcSsgbk7Ox4wCvzfG+3uuhaIwBS9iffjLmctr/DVOACj8WSb7jlzccbQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794847899;
h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
DKIM-Signature:X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:
Message-Instance:X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:
X-ME-Proxy:Feedback-ID:Received:From:To:Cc:Subject:In-Reply-To:
References:Date:Message-ID:User-Agent:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:Content-Type;
bh=a7QmH3K/cgC+sY664dUwhLTryj+5IFwrzIiM26BD2t8=;
b=begGpwRRES9HAQ1wMr0bV8isYhYhTz/eRHiziaoiEaUlkQ+ml7R005sOn9ueSsgFfbYb
NTFitfabIY1cX/Y5/ALA0gz5a8GJ6rZHD/nbMTlwOiPbfy9GLC9chpv9QDYZzS8wdEk9A
C6dYWoZeJUdIKHDG/HJP/qe2ShS0kUeuNnXGkQanNvDrBmzZaMGsSYiCoOnXDDX7deo0M
ZW0t8k+DoHAwxepfLlyiXp+dRVkQ6rsgD7c+NzToftG+nSKVvkxCkVl+57LzxUMYUjid1
c+jyOb2LbtVeMnP0tyfkdRmhaUe1EVW2FUnqE8D8Stvzvj/xTqbaPyJwYqa//2sIbmg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=D2gWZqpr;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=sD5PqnWW;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DA78B606A323;
Mon, 16 Nov 2026 16:51:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=D2gWZqpr;
dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=sD5PqnWW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.150
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794847899;
b=ap3j3xeO71M9niCREFmy4S1fbeSbINzws/ADQaBIolSXsp0jvRpTvHRHO9rWtQDuM2dT
zryCSlPpRWgbMBVXdpV6OPa0YC+u+rQQaHDu843U4/vMrzQ3IuVfGlZioF6Wqry0p/3yI
kTaQuC+5bhmAY7VO6/L8XAtr4BtFs/W6h2cdQx9NqHB9uvZWH7Bwizpa4G1oi6K2UC0NQ
U/pNLtfsPXsEbPzRO161GUVkc+QZ8DRUMzteGT5vfHpJ+u1UJYRafXmeaZ0BueTJLVyAe
ffkDD+cLLIkjNIg9Y1wgBEvL+xTKaqkAF5U5ClhCMG19lenW3DfglKGw7Q2Iov00GlA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794847899;
h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature:
X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance:
X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
User-Agent:MIME-Version:Content-Type;
bh=a7QmH3K/cgC+sY664dUwhLTryj+5IFwrzIiM26BD2t8=;
b=QFE5Qdsevbtl+nfejJ++l7v0tGwsI47laoUnwd1NQO9sr08LlbFom+ewq7G/4LH3YayL
gVOqSHVELYraJUj9WSWZ2nHXVXaDh6/9SeWbDpw29fbGLNKWxXpLCqgEuWpQU9x6Po1VR
Ui8TY3RmloZ8/S3TXX4W2yiQMEpwnIWQfYuKDqljWrnWG2SU+NHT3DYKedclvQj1fQRsE
Dm76lpvubes1MGBS1uKrNUExDxdL1ykrDvgCKEN2EkQJq2cddDETEOAtGFcs9Ud+TMzY0
ZYMqHsyhziQ+3adtO5FgQGrjr+4GZBjwQwqrIgORmN6BwtdoyyqzPDlpPZamisVSDZA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=pobox.com;
spf=pass smtp.mailfrom=pobox.com;
dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm2 header.b=D2gWZqpr;
dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=sD5PqnWW;
arc=none smtp.remote-ip=103.168.172.150
X-Received: from fout-a7-smtp.messagingengine.com (fout-a7-smtp.messagingengine.com [103.168.172.150])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83B4B606A31C
for <git@vger.kernel.org>; Mon, 16 Nov 2026 16:51:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 83B4B606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com
X-Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48])
by mailfout.phl.internal (Postfix) with ESMTP id 99708EC0594
for <git@vger.kernel.org>; Mon, 16 Nov 2026 11:51:37 -0500 (EST)
X-Received: from phl-frontend-01 ([10.202.2.160])
by phl-compute-08.internal (MEProxy); Mon, 16 Nov 2026 11:51:37 -0500
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; 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=fm2; t=1794847897; x=1794934297; bh=a7QmH3K/cg
C+sY664dUwhLTryj+5IFwrzIiM26BD2t8=; b=D2gWZqprgBcwleEGt5gwJ7pyT6
+KM2VUAJm3csyJqQ++W0PPjwUB7lN7LN8Oh+M0IgdfQ9L0RvyY23NP1xOTMRrYQK
vGNdqKKQlfI1dfw8O1oXozwRq18TSDAiWkM8tKuN4M7MlnZmwu0jfeEV7WtOREvJ
gZ1JvK5Fhlq4n9LV+M98TNqMaegvdXN+ul+9FVeFmk82RFdjB4vLQyqurJck0Kz2
i2VSDmmxd8PoF754brezlyH5x1E858W6iFpHbs5TRYkJaFo6ZnXfalc9dJaCjdAq
2jsmIFhvfjzbokE4q8uCRfB6t1qNTDySEc+lEEBWAF4NLlvmjn69MQ4eiEBQ==
X-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=fm3; t=
1794847897; x=1794934297; bh=a7QmH3K/cgC+sY664dUwhLTryj+5IFwrzIi
M26BD2t8=; b=sD5PqnWWsLXdwk4/tsdqEV/RPgiqCQ3BLB2TYI4UVoJep3epR9t
51LY1YaO0DQnoo0WHxyZ7Gwy5gzKzq+CrXQOPwtMqjaC2MOLJ+Ey1vbrzCjEb2U8
33z1lfqebglhw5WiK0n+6FpBYVamm6S+6Rq2DSniBZn9uyMikdRtzEuMToFbGGuI
pdneFgCU2T7cVYYLSKmP/eH5AMC+vgw/iUU2h7JpP2LCCwE7MIKo+wixYmCM3w4X
3RsDMRIdDSvsj0lmTx1qYVO/ID9+f9PaTo0gz3YNL9XuwMJGl0KcGJksxqmpL8WN
ECrr9j3nN1fJD+YQRNeo+1TwSPkNyYkG6Mg==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1794847897; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm2:rsa-sha256:Zj6iyvqoW2mkPVUl7MyMWSTmarWNxQNavVShxj3nshJ8HV8
XMzkY40/5U1cok6rguHddS2QQkvzGN6ds6Gglj1WDPXpGeQlHKjgHsiMCXHAMmDf
NW+qPu+SXX46nvH1o/GOtliiiYoYKKAdzwq7PTxiWOYbyxNYy4VMfVJg+CbF/jfY
lfgaAxXKoUg7PZ6Qj9pnBWg7Ab7JsBX4AN331aSw8bVJ7D0nueg4Ey6cymbobzYp
/X6Q15kK6Y4pyboailQXMsuu2Fao1IKzS6dT3Cyd26AZnVvTPiLmYDeON58QfUVf
k0bz6iQHol3Pj2qI3OKpOt+cFg8CzyoP9oqfiKw==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09;
repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox;
action=mi-m=1; hc=12;
hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id,
mime-version,references,subject,to,user-agent;
X-Message-Instance: m=1; h=sha256:0u9nuUezEYbImS5eCE4Hrn7TrRxghtQuq1qvwia/sw8=:Vm1bGgc1X77xDiYacGekVLolfVHjqx4p8YuZxyNT1C0=;
X-ME-Sender: <xms:mTT7aoKtCXISkda44OQ9w0chMaiOKgQZYK9kaoLS1qraOoa2Sypn7g>
<xme:mTT7avmjq6Hg0yFIeyg6arEsvduBogvjN1kGv6X5rSW9PfcdMJGgsn06y6dqK3Qao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sBYlP5flqNHQ>
<xmx:mTT7aqN4VZNVFr8sGEdBmkBXuO6bA_nsIQ_NuJwHgFc4yyM3bDtICA>
<xmx:mTT7anmft29exWWgMF1HNWkLK6NcDqJM8iZMoimkatqBKxUFCZtlNb1q>
X-Feedback-ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
16 Nov 2026 11:51:37 -0500 (EST)
X-Cc: git@vger.kernel.org
X-In-Reply-To: <b7abaeba-1dd9-45f3-ad63-e43c49ee48d4@gmail.com> (Derrick
Stolee's message of "Mon, 16 Nov 2026 08:11:33 -0500")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list