@@ -489,7 +489,7 @@ typedef unsigned long (*sane_truncate_fn)(char *line, unsigned long len);
489
489
490
490
struct emit_callback {
491
491
struct xdiff_emit_state xm ;
492
- int nparents , color_diff ;
492
+ int color_diff ;
493
493
unsigned ws_rule ;
494
494
sane_truncate_fn truncate ;
495
495
const char * * label_path ;
@@ -549,9 +549,8 @@ static void emit_add_line(const char *reset, struct emit_callback *ecbdata, cons
549
549
emit_line (ecbdata -> file , set , reset , line , len );
550
550
else {
551
551
/* Emit just the prefix, then the rest. */
552
- emit_line (ecbdata -> file , set , reset , line , ecbdata -> nparents );
553
- ws_check_emit (line + ecbdata -> nparents ,
554
- len - ecbdata -> nparents , ecbdata -> ws_rule ,
552
+ emit_line (ecbdata -> file , set , reset , line , 1 );
553
+ ws_check_emit (line + 1 , len - 1 , ecbdata -> ws_rule ,
555
554
ecbdata -> file , set , reset , ws );
556
555
}
557
556
}
@@ -576,7 +575,6 @@ static unsigned long sane_truncate_line(struct emit_callback *ecb, char *line, u
576
575
577
576
static void fn_out_consume (void * priv , char * line , unsigned long len )
578
577
{
579
- int i ;
580
578
int color ;
581
579
struct emit_callback * ecbdata = priv ;
582
580
const char * meta = diff_get_color (ecbdata -> color_diff , DIFF_METAINFO );
@@ -598,13 +596,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
598
596
ecbdata -> label_path [0 ] = ecbdata -> label_path [1 ] = NULL ;
599
597
}
600
598
601
- /* This is not really necessary for now because
602
- * this codepath only deals with two-way diffs.
603
- */
604
- for (i = 0 ; i < len && line [i ] == '@' ; i ++ )
605
- ;
606
- if (2 <= i && i < len && line [i ] == ' ' ) {
607
- ecbdata -> nparents = i - 1 ;
599
+ if (line [0 ] == '@' ) {
608
600
len = sane_truncate_line (ecbdata , line , len );
609
601
emit_line (ecbdata -> file ,
610
602
diff_get_color (ecbdata -> color_diff , DIFF_FRAGINFO ),
@@ -614,15 +606,12 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
614
606
return ;
615
607
}
616
608
617
- if (len < ecbdata -> nparents ) {
609
+ if (len < 1 ) {
618
610
emit_line (ecbdata -> file , reset , reset , line , len );
619
611
return ;
620
612
}
621
613
622
614
color = DIFF_PLAIN ;
623
- if (ecbdata -> diff_words && ecbdata -> nparents != 1 )
624
- /* fall back to normal diff */
625
- free_diff_words_data (ecbdata );
626
615
if (ecbdata -> diff_words ) {
627
616
if (line [0 ] == '-' ) {
628
617
diff_words_append (line , len ,
@@ -641,13 +630,10 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
641
630
emit_line (ecbdata -> file , plain , reset , line , len );
642
631
return ;
643
632
}
644
- for (i = 0 ; i < ecbdata -> nparents && len ; i ++ ) {
645
- if (line [i ] == '-' )
646
- color = DIFF_FILE_OLD ;
647
- else if (line [i ] == '+' )
648
- color = DIFF_FILE_NEW ;
649
- }
650
-
633
+ if (line [0 ] == '-' )
634
+ color = DIFF_FILE_OLD ;
635
+ else if (line [0 ] == '+' )
636
+ color = DIFF_FILE_NEW ;
651
637
if (color != DIFF_FILE_NEW ) {
652
638
emit_line (ecbdata -> file ,
653
639
diff_get_color (ecbdata -> color_diff , color ),
0 commit comments