Skip to content

Commit bdbd7d2

Browse files
committed
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 <[email protected]>
1 parent 623e608 commit bdbd7d2

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

builtin/fetch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
20022002
}
20032003

20042004
git_config(git_fetch_config, NULL);
2005+
prepare_repo_settings(the_repository);
2006+
the_repository->settings.command_requires_full_index = 0;
20052007

20062008
argc = parse_options(argc, argv, prefix,
20072009
builtin_fetch_options, builtin_fetch_usage, 0);

builtin/pull.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
966966
set_reflog_message(argc, argv);
967967

968968
git_config(git_pull_config, NULL);
969+
prepare_repo_settings(the_repository);
970+
the_repository->settings.command_requires_full_index = 0;
969971

970972
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
971973

0 commit comments

Comments
 (0)