@@ -464,7 +464,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
464464 newinfo .pathspec = info -> pathspec ;
465465 newinfo .name = * p ;
466466 newinfo .pathlen += tree_entry_len (p ) + 1 ;
467- newinfo .conflicts |= df_conflicts ;
467+ newinfo .df_conflicts |= df_conflicts ;
468468
469469 for (i = 0 ; i < n ; i ++ , dirmask >>= 1 ) {
470470 const unsigned char * sha1 = NULL ;
@@ -565,17 +565,12 @@ static int unpack_nondirectories(int n, unsigned long mask,
565565{
566566 int i ;
567567 struct unpack_trees_options * o = info -> data ;
568- unsigned long conflicts ;
568+ unsigned long conflicts = info -> df_conflicts | dirmask ;
569569
570570 /* Do we have *only* directories? Nothing to do */
571571 if (mask == dirmask && !src [0 ])
572572 return 0 ;
573573
574- conflicts = info -> conflicts ;
575- if (o -> merge )
576- conflicts >>= 1 ;
577- conflicts |= dirmask ;
578-
579574 /*
580575 * Ok, we've filled in up to any potential index entry in src[0],
581576 * now do the rest.
@@ -807,13 +802,6 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
807802
808803 /* Now handle any directories.. */
809804 if (dirmask ) {
810- unsigned long conflicts = mask & ~dirmask ;
811- if (o -> merge ) {
812- conflicts <<= 1 ;
813- if (src [0 ])
814- conflicts |= 1 ;
815- }
816-
817805 /* special case: "diff-index --cached" looking at a tree */
818806 if (o -> diff_index_cached &&
819807 n == 1 && dirmask == 1 && S_ISDIR (names -> mode )) {
@@ -832,7 +820,7 @@ static int unpack_callback(int n, unsigned long mask, unsigned long dirmask, str
832820 }
833821 }
834822
835- if (traverse_trees_recursive (n , dirmask , conflicts ,
823+ if (traverse_trees_recursive (n , dirmask , mask & ~ dirmask ,
836824 names , info ) < 0 )
837825 return -1 ;
838826 return mask ;
0 commit comments