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