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 @@ -2316,10 +2316,24 @@ int git_config_get_virtualfilesystem(void)
23162316 if (core_virtualfilesystem && !* core_virtualfilesystem )
23172317 core_virtualfilesystem = NULL ;
23182318
2319- /* virtual file system relies on the sparse checkout logic so force it on */
23202319 if (core_virtualfilesystem ) {
2321- core_apply_sparse_checkout = 1 ;
2322- return 1 ;
2320+ /*
2321+ * Some git commands spawn helpers and redirect the index to a different
2322+ * location. These include "difftool -d" and the sequencer
2323+ * (i.e. `git rebase -i`, `git cherry-pick` and `git revert`) and others.
2324+ * In those instances we don't want to update their temporary index with
2325+ * our virtualization data.
2326+ */
2327+ char * default_index_file = xstrfmt ("%s/%s" , the_repository -> gitdir , "index" );
2328+ int should_run_hook = !strcmp (default_index_file , the_repository -> index_file );
2329+
2330+ free (default_index_file );
2331+ if (should_run_hook ) {
2332+ /* virtual file system relies on the sparse checkout logic so force it on */
2333+ core_apply_sparse_checkout = 1 ;
2334+ return 1 ;
2335+ }
2336+ core_virtualfilesystem = NULL ;
23232337 }
23242338
23252339 return 0 ;
You can’t perform that action at this time.
0 commit comments