File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -2318,10 +2318,24 @@ int git_config_get_virtualfilesystem(void)
23182318 if (core_virtualfilesystem && !* core_virtualfilesystem )
23192319 core_virtualfilesystem = NULL ;
23202320
2321- /* virtual file system relies on the sparse checkout logic so force it on */
23222321 if (core_virtualfilesystem ) {
2323- core_apply_sparse_checkout = 1 ;
2324- return 1 ;
2322+ /*
2323+ * Some git commands spawn helpers and redirect the index to a different
2324+ * location. These include "difftool -d" and the sequencer
2325+ * (i.e. `git rebase -i`, `git cherry-pick` and `git revert`) and others.
2326+ * In those instances we don't want to update their temporary index with
2327+ * our virtualization data.
2328+ */
2329+ char * default_index_file = xstrfmt ("%s/%s" , the_repository -> gitdir , "index" );
2330+ int should_run_hook = !strcmp (default_index_file , the_repository -> index_file );
2331+
2332+ free (default_index_file );
2333+ if (should_run_hook ) {
2334+ /* virtual file system relies on the sparse checkout logic so force it on */
2335+ core_apply_sparse_checkout = 1 ;
2336+ return 1 ;
2337+ }
2338+ core_virtualfilesystem = NULL ;
23252339 }
23262340
23272341 return 0 ;
You can’t perform that action at this time.
0 commit comments