Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtualfilesystem: don't run the virtual file system hook if the index has been redirected #15

Merged
merged 1 commit into from
Aug 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -2316,10 +2316,24 @@ int git_config_get_virtualfilesystem(void)
if (core_virtualfilesystem && !*core_virtualfilesystem)
core_virtualfilesystem = NULL;

/* virtual file system relies on the sparse checkout logic so force it on */
if (core_virtualfilesystem) {
core_apply_sparse_checkout = 1;
return 1;
/*
* Some git commands spawn helpers and redirect the index to a different
* location. These include "difftool -d" and the sequencer
* (i.e. `git rebase -i`, `git cherry-pick` and `git revert`) and others.
* In those instances we don't want to update their temporary index with
* our virtualization data.
*/
char *default_index_file = xstrfmt("%s/%s", the_repository->gitdir, "index");
int should_run_hook = !strcmp(default_index_file, the_repository->index_file);

free(default_index_file);
if (should_run_hook) {
/* virtual file system relies on the sparse checkout logic so force it on */
core_apply_sparse_checkout = 1;
return 1;
}
core_virtualfilesystem = NULL;
}

return 0;
Expand Down