Skip to content

Commit a633149

Browse files
derrickstoleedscho
authored andcommitted
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 e74a398 commit a633149

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
@@ -1987,6 +1987,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
19871987
}
19881988

19891989
git_config(git_fetch_config, NULL);
1990+
prepare_repo_settings(the_repository);
1991+
the_repository->settings.command_requires_full_index = 0;
19901992

19911993
argc = parse_options(argc, argv, prefix,
19921994
builtin_fetch_options, builtin_fetch_usage, 0);

builtin/pull.c

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

956956
git_config(git_pull_config, NULL);
957+
prepare_repo_settings(the_repository);
958+
the_repository->settings.command_requires_full_index = 0;
957959

958960
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
959961

0 commit comments

Comments
 (0)