@@ -368,17 +368,14 @@ static int merge_working_tree(struct checkout_opts *opts,
368368 int ret ;
369369 struct lock_file * lock_file = xcalloc (1 , sizeof (struct lock_file ));
370370 int newfd = hold_locked_index (lock_file , 1 );
371- int reprime_cache_tree = 0 ;
372371
373372 if (read_cache () < 0 )
374373 return error ("corrupt index file" );
375374
376- cache_tree_free (& active_cache_tree );
377375 if (opts -> force ) {
378376 ret = reset_tree (new -> commit -> tree , opts , 1 );
379377 if (ret )
380378 return ret ;
381- reprime_cache_tree = 1 ;
382379 } else {
383380 struct tree_desc trees [2 ];
384381 struct tree * tree ;
@@ -414,9 +411,7 @@ static int merge_working_tree(struct checkout_opts *opts,
414411 init_tree_desc (& trees [1 ], tree -> buffer , tree -> size );
415412
416413 ret = unpack_trees (2 , trees , & topts );
417- if (ret != -1 ) {
418- reprime_cache_tree = 1 ;
419- } else {
414+ if (ret == -1 ) {
420415 /*
421416 * Unpack couldn't do a trivial merge; either
422417 * give up or do a real merge, depending on
@@ -460,8 +455,6 @@ static int merge_working_tree(struct checkout_opts *opts,
460455 }
461456 }
462457
463- if (reprime_cache_tree )
464- prime_cache_tree (& active_cache_tree , new -> commit -> tree );
465458 if (write_cache (newfd , active_cache , active_nr ) ||
466459 commit_locked_index (lock_file ))
467460 die ("unable to write new index file" );
0 commit comments