@@ -204,7 +204,7 @@ static void consume_line(void *state_, char *line, unsigned long len)
204
204
static void combine_diff (const unsigned char * parent , unsigned int mode ,
205
205
mmfile_t * result_file ,
206
206
struct sline * sline , unsigned int cnt , int n ,
207
- int num_parent )
207
+ int num_parent , int result_deleted )
208
208
{
209
209
unsigned int p_lno , lno ;
210
210
unsigned long nmask = (1UL << n );
@@ -215,7 +215,7 @@ static void combine_diff(const unsigned char *parent, unsigned int mode,
215
215
struct combine_diff_state state ;
216
216
unsigned long sz ;
217
217
218
- if (! cnt )
218
+ if (result_deleted )
219
219
return ; /* result deleted */
220
220
221
221
parent_file .ptr = grab_blob (parent , mode , & sz );
@@ -517,7 +517,7 @@ static void show_line_to_eol(const char *line, int len, const char *reset)
517
517
}
518
518
519
519
static void dump_sline (struct sline * sline , unsigned long cnt , int num_parent ,
520
- int use_color )
520
+ int use_color , int result_deleted )
521
521
{
522
522
unsigned long mark = (1UL <<num_parent );
523
523
unsigned long no_pre_delete = (2UL <<num_parent );
@@ -530,7 +530,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,
530
530
const char * c_plain = diff_get_color (use_color , DIFF_PLAIN );
531
531
const char * c_reset = diff_get_color (use_color , DIFF_RESET );
532
532
533
- if (! cnt )
533
+ if (result_deleted )
534
534
return ; /* result deleted */
535
535
536
536
while (1 ) {
@@ -687,6 +687,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
687
687
{
688
688
struct diff_options * opt = & rev -> diffopt ;
689
689
unsigned long result_size , cnt , lno ;
690
+ int result_deleted = 0 ;
690
691
char * result , * cp ;
691
692
struct sline * sline ; /* survived lines */
692
693
int mode_differs = 0 ;
@@ -767,6 +768,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
767
768
}
768
769
else {
769
770
deleted_file :
771
+ result_deleted = 1 ;
770
772
result_size = 0 ;
771
773
elem -> mode = 0 ;
772
774
result = xcalloc (1 , 1 );
@@ -823,7 +825,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
823
825
combine_diff (elem -> parent [i ].sha1 ,
824
826
elem -> parent [i ].mode ,
825
827
& result_file , sline ,
826
- cnt , i , num_parent );
828
+ cnt , i , num_parent , result_deleted );
827
829
if (elem -> parent [i ].mode != elem -> mode )
828
830
mode_differs = 1 ;
829
831
}
@@ -889,7 +891,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
889
891
dump_quoted_path ("+++ " , b_prefix , elem -> path ,
890
892
c_meta , c_reset );
891
893
dump_sline (sline , cnt , num_parent ,
892
- DIFF_OPT_TST (opt , COLOR_DIFF ));
894
+ DIFF_OPT_TST (opt , COLOR_DIFF ), result_deleted );
893
895
}
894
896
free (result );
895
897
0 commit comments