From bdbd7d2ef1a527dba2600b5c938ce488f225a382 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Wed, 20 Oct 2021 20:54:17 -0400 Subject: [PATCH] fetch/pull: use the sparse index The 'git fetch' and 'git pull' commands somehow read the index. In the case of 'git pull', much of the reason is that the HEAD might change due to the update from the remote. It is unclear why 'git fetch' needs it. However, I was able to measure time in ensure_full_index() because these commands do parse an index. Signed-off-by: Derrick Stolee --- builtin/fetch.c | 2 ++ builtin/pull.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/builtin/fetch.c b/builtin/fetch.c index da10d1d532b733..67218c23cc6607 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -2002,6 +2002,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) } git_config(git_fetch_config, NULL); + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; argc = parse_options(argc, argv, prefix, builtin_fetch_options, builtin_fetch_usage, 0); diff --git a/builtin/pull.c b/builtin/pull.c index efe4f4a81f944e..5eb3b39dba06f9 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -966,6 +966,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix) set_reflog_message(argc, argv); git_config(git_pull_config, NULL); + prepare_repo_settings(the_repository); + the_repository->settings.command_requires_full_index = 0; argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);