Skip to content

Commit

Permalink
fetch/pull: use the sparse index
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
derrickstolee authored and ldennington committed Jan 19, 2022
1 parent fb79022 commit 8c64b07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions builtin/pull.c
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,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);

Expand Down

0 comments on commit 8c64b07

Please sign in to comment.