Skip to content

Commit f568e23

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 beea034 commit f568e23

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
@@ -960,6 +960,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
960960
set_reflog_message(argc, argv);
961961

962962
git_config(git_pull_config, NULL);
963+
prepare_repo_settings(the_repository);
964+
the_repository->settings.command_requires_full_index = 0;
963965

964966
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
965967

0 commit comments

Comments
 (0)