From: Junio C Hamano <gitster@pobox.com>
To: Phillip Wood <phillip.wood123@gmail.com>
Cc: git@vger.kernel.org, 重田一聖 <kazumasa.shigeta@kanamei.com>
Subject: Re: [PATCH v2 6/7] stash create: remove unnecessary index load and refresh
Date: Wed, 14 Oct 2026 11:21:47 -0700 [thread overview]
Message-ID: <xmqqmrsgrvlw.fsf@gitster.g> (raw)
In-Reply-To: <768d6bc7e5a8c47e1d727917cbd8818f1906cb17.1791992404.git.phillip.wood@dunelm.org.uk> (Phillip Wood's message of "Wed, 14 Oct 2026 16:40:18 +0100")
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));
next prev parent reply other threads:[~2026-10-14 18:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-05 16:35 [PATCH 0/2] stash: stop checking for changes twice Phillip Wood
2026-10-05 16:35 ` [PATCH 1/2] stash create: remove duplicate changes detection Phillip Wood
2026-10-06 12:44 ` Junio C Hamano
2026-10-07 13:49 ` Phillip Wood
2026-10-05 16:35 ` [PATCH 2/2] stash push: " Phillip Wood
2026-10-06 14:27 ` Junio C Hamano
2026-10-07 13:46 ` Phillip Wood
2026-10-07 17:15 ` Junio C Hamano
2026-10-08 13:35 ` Phillip Wood
2026-10-14 15:40 ` [PATCH v2 0/7] stash creation: avoid unecessary index loads and refreshes Phillip Wood
2026-10-14 15:40 ` [PATCH v2 1/7] stash: use an enum for create status Phillip Wood
2026-10-14 15:40 ` [PATCH v2 2/7] stash create: remove duplicate changes detection Phillip Wood
2026-10-14 15:40 ` [PATCH v2 3/7] stash push: " Phillip Wood
2026-10-14 15:40 ` [PATCH v2 4/7] stash push: avoid duplicate calls to preload_index() Phillip Wood
2026-10-14 18:09 ` Junio C Hamano
2026-10-14 15:40 ` [PATCH v2 5/7] stash create: rework temporary index creation Phillip Wood
2026-10-14 18:16 ` Junio C Hamano
2026-10-14 15:40 ` [PATCH v2 6/7] stash create: remove unnecessary index load and refresh Phillip Wood
2026-10-14 18:21 ` Junio C Hamano [this message]
2026-10-14 15:40 ` [PATCH v2 7/7] stash: simplify reset_tree() function signature Phillip Wood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqmrsgrvlw.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=kazumasa.shigeta@kanamei.com \
--cc=phillip.wood123@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.