[PATCH v2 6/7] stash create: remove unnecessary index load and refresh
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Oct 14, 2026, 15:40 UTC
- Message-ID
- <768d6bc7e5a8c47e1d727917cbd8818f1906cb17.1791992404.git.phillip.wood@dunelm.org.uk>
- In-Reply-To
- <cover.1791992404.git.phillip.wood@dunelm.org.uk>
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); - hold_lock_file_for_update(&lock_file, index_path, LOCK_DIE_ON_ERROR); memset(&opts, 0, sizeof(opts));
-- 2.56.0.134.g299a3c16181