Article View: linux.kernel.git
Article #538Re: [PATCH v2 6/7] stash create: remove unnecessary index load and refresh
From: Junio C Hamano
Date: Wed, 14 Oct 2026 18:21
Date: Wed, 14 Oct 2026 18:21
34 lines
10979 bytes
10979 bytes
Phillip Wood <phillip.wood123@gmail.com> writes: > From: Phillip Wood <phillip.wood@dunelm.org.uk> > > create_index_from_tree() is called either directly or indirectly > from do_create_stash() after it has loaded and refreshed the index, > so we do not need to refresh it again here. This saves three lstat() > calls per changed path. > > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> > --- > builtin/stash.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/builtin/stash.c b/builtin/stash.c > index ddeb5a5d2a..55916259c3 100644 > --- a/builtin/stash.c > +++ b/builtin/stash.c > @@ -384,9 +384,6 @@ static int create_index_from_tree(const struct object_id *tree_id, > struct index_state dst_istate = INDEX_STATE_INIT(the_repository); > struct lock_file lock_file = LOCK_INIT; > > - repo_read_index_preload(the_repository, NULL, 0); > - refresh_index(the_repository->index, REFRESH_QUIET, NULL, NULL, NULL); > - Oh, it is emrarrasingly stupid follow read_index_preload() with refresh_index(), since the reason former is not read_index() is because we want it refreshed. The original is doubly bad. > hold_lock_file_for_update(&lock_file, index_path, LOCK_DIE_ON_ERROR); > > memset(&opts, 0, sizeof(opts));
Technical Details
Message-ID:
<xmqqmrsgrvlw.fsf@gitster.g>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72048-linux-kernel-git=dewy.ruReferences:
<cover.1791218125.git.phillip.wood@dunelm.org.uk> <cover.1791992404.git.phillip.wood@dunelm.org.uk> <768d6bc7e5a8c47e1d727917cbd8818f1906cb17.1791992404.git.phillip.wood@dunelm.org.uk>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-72048-linux-kernel-git=dewy.ru
From: gitster@pobox.com (Junio C Hamano)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 6/7] stash create: remove unnecessary index load and
refresh
Date: Wed, 14 Oct 2026 11:21:47 -0700
Organization: Usenet Network
Message-ID: <xmqqmrsgrvlw.fsf@gitster.g>
References: <cover.1791218125.git.phillip.wood@dunelm.org.uk>
<cover.1791992404.git.phillip.wood@dunelm.org.uk>
<768d6bc7e5a8c47e1d727917cbd8818f1906cb17.1791992404.git.phillip.wood@dunelm.org.uk>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
logging-data="2358742"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:nPVtFWOYNtsXla1nWEJhteR/RCs= sha256:GPzdhLKQ0bH5mHctf07mLZFpvCbeZG1oGtGG/pHZyUQ=
sha1:/9+zCI/L96g1Trf9Amm1jly3FLg= sha256:cXTvRduFB7z2mfijSHZkJkfklH+qAT9jmxztBYaR8EI=
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 AA7DB110195; Wed, 14 Oct 2026 21:22:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.149
X-Spam-Status: No, score=-3.149 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.25, 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=Bhry2KS9; dkim=pass (2048-bit key)
header.d=messagingengine.com header.b=btgv4hUq
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 nVZf8YkAPWji;
Wed, 14 Oct 2026 21:22:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=git+bounces-72048-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
by mail.dewy.ru (Postfix) with ESMTPS id 21F3D110167; Wed, 14 Oct 2026 21:21:57 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
by sto.lore.kernel.org (Postfix) with ESMTP id 4896860D876; Wed, 14 Oct 2026 18:21:56 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CC434568FBE;
Wed, 14 Oct 2026 18:21:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="Bhry2KS9";
dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="btgv4hUq"
X-Received: from fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158])
(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 3986040627B
for <git@vger.kernel.org>; Wed, 14 Oct 2026 18:21:49 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.158
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1792002111; cv=none; b=V6/reLamDJHoUJXjaPhPzRDree40o2bEtrzc3Xj8zH59+kfrkF7/+qB1BrKT4YqsG91+N6qt7Lh59O9MxRJx6hOAj0PtkxJcTNjFA7Vrr6RWw/WXCytDnSrAQs41IKpLbz9mGn0IdDEQYTX5LFadrLrR52eoJZD5mWKHTWyxx5k=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1792002111; c=relaxed/simple;
bh=9uGgV7wY+xvtvCH9DupLruAFmpgoBg3Vm6VWoPXN7MA=;
h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID:
MIME-Version:Content-Type; b=jiO+IwMgT1JPLVR7fO6ebxxkQoPiu16DgNtsHHkF0apqVLVOwNVMgS18O74COCMJWIWXolwuCtDqGChoG2CZcv6vL7BPSoVjZ3bQKTEHH0UhQ0lfvZ3gXjx4D1GFkpvAyRNwBjR48631GDylbCgAq4Lh1l64RlknV/Hb0VTMYp8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=Bhry2KS9; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=btgv4hUq; arc=none smtp.client-ip=103.168.172.158
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-01.internal (phl-compute-01.internal [10.202.2.41])
by mailfhigh.phl.internal (Postfix) with ESMTP id 583B8140010B
for <git@vger.kernel.org>; Wed, 14 Oct 2026 14:21:49 -0400 (EDT)
X-Received: from phl-frontend-02 ([10.202.2.161])
by phl-compute-01.internal (MEProxy); Wed, 14 Oct 2026 14:21:49 -0400
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=fm1; t=1792002109; x=1792088509; bh=tUY7K55j02
eGFnQb/DiSLbltZI/JdszHTLKFt3Hgd/o=; b=Bhry2KS99WEMUK0kltblRznrDL
aIpfry1sOssn848KY0kVfhIiZbR/AaAsUu7MM2sLCL0Pz/dbiLenVkyDESTqfekK
0qdmWP7uFafbFoPXAdGtd/PFrKi8tfUdAnma2XMGlH8JUi5VHiLjc2kGb6U87QX3
VZeDB+tIe/tC9UVwxH454Q4CMnFaBO73OQ1D34zKIkwYTlQrhr9Fl141brBiDTN6
6X0KyVf53pJ7uI0BLZ/TTTHdPPRgi2rDgSzJmoHXuGkAMN1K71EFc7mPH8OQOlua
y5JU2HDJB0rYjDs9AU/tnptmEs0CuVaHnEhi4Di7vVQEwgXw2cKNrz2Nq52g==
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=fm2; t=
1792002109; x=1792088509; bh=tUY7K55j02eGFnQb/DiSLbltZI/JdszHTLK
Ft3Hgd/o=; b=btgv4hUqGjEwcDUVs2ua4UyvHwCaYGKeE3jOS0UbidEffc17HJj
jltvdVtj+2lbUpuw0RHHSRBDm+4IdEL+cLm3uCTM2u9hMKEzVGImn3nCtw2VvsmV
x80r6X5vFit3xRlcpmHaKrePmYahnktHC1xQh83tQhWSwW4IdYRKv4ZvEuhNWEm0
PQOwgMMpMft5C79mrnerNkc1rSyQNZ6vVtziw9b7MOfzNZBxHTC/cI1xQgUFXK4B
FPOLNP6wk5ZDVIb+2Gxzy71MFMbnsLGnL5bNFY1IZ2CYt/ncFG2OjP3kZ+lKGtMi
kbZ0BcS8jO2MNstmV7KBvpK0HPCok0h08Sg==
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; sw=lmtpprox;
action=sign d=pobox.com a=rsa-sha256;
X-DKIM2-Signature: i=1; m=1; t=1792002109; d=pobox.com;
mf=PGdpdHN0ZXJAcG9ib3guY29tPg==;
rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+;
s=fm1:rsa-sha256:g8uI1Vg+zsygSDLtLvWi5Ste1fP0cVijrg6P39UZGtjuoK1
0Gk/p4YHZfy0+HjcXpZcPMi/iEtvWtzTEg0YDwPpHk1SZRN94oHUbUS7+cA8oDlh
q9jarBFR37SFvM8IW4QJM8wI7Jq2DZjt5+JKPOLwKe4B20/x/72ZljU/DrSYq9P7
VxCNEs1CidftGbwcNH1fGBJkMS6lv7sxZOWjJDrrfpOT/ot1T6HmswJjuhMZZZMe
BWN0ACtQMB75C4AB+QbhZTjmTzqpCw3AL1wGKQv3zPbTXXjVgNJNrjCe8b84JGvS
jehwu9esWaf1nbmNqi+5+0ja2C1jj+9lvVwbqpQ==;
X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-06;
repo=github.com/dkim2wg/interop; date=2026-10-04; 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:KKP8kMJzizR5pNwuLmV6QkTVvhrexUn7Dqf2fIBP40U=:9uGgV7wY+xvtvCH9DupLruAFmpgoBg3Vm6VWoPXN7MA=;
X-ME-Sender: <xms:PcjPal2YsT5pq3oQhX5VDaarpBuGR4U1vptmAPW-ZsSa-KygzR56NQ>
<xme:PcjPajEubL-SIv_A_ObJk6VuAElKy647UTWe57iTd_ZnC4yeJZeqMUKMi8nSrq-kK
JxpFFK4BoKbj02sdi1r-XV-7SDnNQ1EafFqHYXlU6rgxO06b9YWCg>
X-ME-Received: <xmr:PcjPaq6-pTMuU0mdROTt8VZEXSg-7bBLFAUt_okst-DyFtuZ98u-bBNFRTabi8dYyXxzz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ID: if26b431b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
14 Oct 2026 14:21:48 -0400 (EDT)
X-Cc: git@vger.kernel.org, ιη°δΈθ
<kazumasa.shigeta@kanamei.com>
X-In-Reply-To: <768d6bc7e5a8c47e1d727917cbd8818f1906cb17.1791992404.git.phillip.wood@dunelm.org.uk>
(Phillip Wood's message of "Wed, 14 Oct 2026 16:40:18 +0100")
X-User-Agent: Gnus/5.13 (Gnus v5.13)
X-Precedence: bulk
X-Mailing-List: git@vger.kernel.org
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>