@@ -768,7 +768,8 @@ static void show_combined_header(struct combine_diff_path *elem,
768768}
769769
770770static void show_patch_diff (struct combine_diff_path * elem , int num_parent ,
771- int dense , struct rev_info * rev )
771+ int dense , int working_tree_file ,
772+ struct rev_info * rev )
772773{
773774 struct diff_options * opt = & rev -> diffopt ;
774775 unsigned long result_size , cnt , lno ;
@@ -777,7 +778,6 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
777778 struct sline * sline ; /* survived lines */
778779 int mode_differs = 0 ;
779780 int i , show_hunks ;
780- int working_tree_file = is_null_sha1 (elem -> sha1 );
781781 mmfile_t result_file ;
782782 struct userdiff_driver * userdiff ;
783783 struct userdiff_driver * textconv = NULL ;
@@ -1028,6 +1028,12 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
10281028 write_name_quoted (p -> path , stdout , line_termination );
10291029}
10301030
1031+ /*
1032+ * The result (p->elem) is from the working tree and their
1033+ * parents are typically from multiple stages during a merge
1034+ * (i.e. diff-files) or the state in HEAD and in the index
1035+ * (i.e. diff-index).
1036+ */
10311037void show_combined_diff (struct combine_diff_path * p ,
10321038 int num_parent ,
10331039 int dense ,
@@ -1041,7 +1047,7 @@ void show_combined_diff(struct combine_diff_path *p,
10411047 DIFF_FORMAT_NAME_STATUS ))
10421048 show_raw_diff (p , num_parent , rev );
10431049 else if (opt -> output_format & DIFF_FORMAT_PATCH )
1044- show_patch_diff (p , num_parent , dense , rev );
1050+ show_patch_diff (p , num_parent , dense , 1 , rev );
10451051}
10461052
10471053void diff_tree_combined (const unsigned char * sha1 ,
@@ -1109,7 +1115,7 @@ void diff_tree_combined(const unsigned char *sha1,
11091115 for (p = paths ; p ; p = p -> next ) {
11101116 if (p -> len )
11111117 show_patch_diff (p , num_parent , dense ,
1112- rev );
1118+ 0 , rev );
11131119 }
11141120 }
11151121 }
0 commit comments