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 @@ -2318,10 +2318,24 @@ int git_config_get_virtualfilesystem(void)
2318
2318
if (core_virtualfilesystem && !* core_virtualfilesystem )
2319
2319
core_virtualfilesystem = NULL ;
2320
2320
2321
- /* virtual file system relies on the sparse checkout logic so force it on */
2322
2321
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 ;
2325
2339
}
2326
2340
2327
2341
return 0 ;
You can’t perform that action at this time.
0 commit comments