@@ -3534,15 +3534,6 @@ static int set_diff_algorithm(struct diff_options *opts,
35343534 return 0 ;
35353535}
35363536
3537- static void report_binary_file (struct strbuf * buf ,
3538- struct repository * repo ,
3539- struct diff_filespec * spec ,
3540- const char * path )
3541- {
3542- const char * type = diff_filespec_is_binary (repo , spec ) ? "binary" : "text" ;
3543- strbuf_addf (buf , "%s: %s\n" , path , type );
3544- }
3545-
35463537static void builtin_diff (const char * name_a ,
35473538 const char * name_b ,
35483539 struct diff_filespec * one ,
@@ -3684,10 +3675,6 @@ static void builtin_diff(const char *name_a,
36843675 header .buf , header .len , 0 );
36853676 strbuf_addf (& sb , "%sBinary files %s and %s differ\n" ,
36863677 diff_line_prefix (o ), lbl [0 ], lbl [1 ]);
3687- if (o -> report_binary_files ) {
3688- report_binary_file (& sb , o -> repo , one , lbl [0 ]);
3689- report_binary_file (& sb , o -> repo , two , lbl [1 ]);
3690- }
36913678 emit_diff_symbol (o , DIFF_SYMBOL_BINARY_FILES ,
36923679 sb .buf , sb .len , 0 );
36933680 strbuf_release (& sb );
@@ -3712,10 +3699,6 @@ static void builtin_diff(const char *name_a,
37123699 else {
37133700 strbuf_addf (& sb , "%sBinary files %s and %s differ\n" ,
37143701 diff_line_prefix (o ), lbl [0 ], lbl [1 ]);
3715- if (o -> report_binary_files ) {
3716- report_binary_file (& sb , o -> repo , one , lbl [0 ]);
3717- report_binary_file (& sb , o -> repo , two , lbl [1 ]);
3718- }
37193702 emit_diff_symbol (o , DIFF_SYMBOL_BINARY_FILES ,
37203703 sb .buf , sb .len , 0 );
37213704 strbuf_release (& sb );
@@ -6124,6 +6107,13 @@ static void diff_flush_raw(struct diff_filepair *p, struct diff_options *opt)
61246107 fprintf (opt -> file , "%s " ,
61256108 diff_aligned_abbrev (& p -> two -> oid , opt -> abbrev ));
61266109 }
6110+
6111+ if (opt -> report_binary_files ) {
6112+ char one = diff_filespec_is_binary (opt -> repo , p -> one ) ? 'B' : 'T' ;
6113+ char two = diff_filespec_is_binary (opt -> repo , p -> two ) ? 'B' : 'T' ;
6114+ fprintf (opt -> file , "%c%c " , one , two );
6115+ }
6116+
61276117 if (p -> score ) {
61286118 fprintf (opt -> file , "%c%03d%c" , p -> status , similarity_index (p ),
61296119 inter_name_termination );
0 commit comments