@@ -489,7 +489,7 @@ typedef unsigned long (*sane_truncate_fn)(char *line, unsigned long len);
489489
490490struct emit_callback {
491491 struct xdiff_emit_state xm ;
492- int nparents , color_diff ;
492+ int color_diff ;
493493 unsigned ws_rule ;
494494 sane_truncate_fn truncate ;
495495 const char * * label_path ;
@@ -549,9 +549,8 @@ static void emit_add_line(const char *reset, struct emit_callback *ecbdata, cons
549549 emit_line (ecbdata -> file , set , reset , line , len );
550550 else {
551551 /* 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 ,
555554 ecbdata -> file , set , reset , ws );
556555 }
557556}
@@ -576,7 +575,6 @@ static unsigned long sane_truncate_line(struct emit_callback *ecb, char *line, u
576575
577576static void fn_out_consume (void * priv , char * line , unsigned long len )
578577{
579- int i ;
580578 int color ;
581579 struct emit_callback * ecbdata = priv ;
582580 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)
598596 ecbdata -> label_path [0 ] = ecbdata -> label_path [1 ] = NULL ;
599597 }
600598
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 ] == '@' ) {
608600 len = sane_truncate_line (ecbdata , line , len );
609601 emit_line (ecbdata -> file ,
610602 diff_get_color (ecbdata -> color_diff , DIFF_FRAGINFO ),
@@ -614,15 +606,12 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
614606 return ;
615607 }
616608
617- if (len < ecbdata -> nparents ) {
609+ if (len < 1 ) {
618610 emit_line (ecbdata -> file , reset , reset , line , len );
619611 return ;
620612 }
621613
622614 color = DIFF_PLAIN ;
623- if (ecbdata -> diff_words && ecbdata -> nparents != 1 )
624- /* fall back to normal diff */
625- free_diff_words_data (ecbdata );
626615 if (ecbdata -> diff_words ) {
627616 if (line [0 ] == '-' ) {
628617 diff_words_append (line , len ,
@@ -641,13 +630,10 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
641630 emit_line (ecbdata -> file , plain , reset , line , len );
642631 return ;
643632 }
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 ;
651637 if (color != DIFF_FILE_NEW ) {
652638 emit_line (ecbdata -> file ,
653639 diff_get_color (ecbdata -> color_diff , color ),
0 commit comments