@@ -354,7 +354,6 @@ struct emit_callback {
354
354
const char * * label_path ;
355
355
struct diff_words_data * diff_words ;
356
356
struct diff_options * opt ;
357
- int * found_changesp ;
358
357
struct strbuf * header ;
359
358
};
360
359
@@ -722,7 +721,6 @@ static void emit_rewrite_diff(const char *name_a,
722
721
723
722
memset (& ecbdata , 0 , sizeof (ecbdata ));
724
723
ecbdata .color_diff = want_color (o -> use_color );
725
- ecbdata .found_changesp = & o -> found_changes ;
726
724
ecbdata .ws_rule = whitespace_rule (name_b );
727
725
ecbdata .opt = o ;
728
726
if (ecbdata .ws_rule & WS_BLANK_AT_EOF ) {
@@ -1216,22 +1214,23 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1216
1214
struct diff_options * o = ecbdata -> opt ;
1217
1215
const char * line_prefix = diff_line_prefix (o );
1218
1216
1217
+ o -> found_changes = 1 ;
1218
+
1219
1219
if (ecbdata -> header ) {
1220
- fprintf (ecbdata -> opt -> file , "%s" , ecbdata -> header -> buf );
1220
+ fprintf (o -> file , "%s" , ecbdata -> header -> buf );
1221
1221
strbuf_reset (ecbdata -> header );
1222
1222
ecbdata -> header = NULL ;
1223
1223
}
1224
- * (ecbdata -> found_changesp ) = 1 ;
1225
1224
1226
1225
if (ecbdata -> label_path [0 ]) {
1227
1226
const char * name_a_tab , * name_b_tab ;
1228
1227
1229
1228
name_a_tab = strchr (ecbdata -> label_path [0 ], ' ' ) ? "\t" : "" ;
1230
1229
name_b_tab = strchr (ecbdata -> label_path [1 ], ' ' ) ? "\t" : "" ;
1231
1230
1232
- fprintf (ecbdata -> opt -> file , "%s%s--- %s%s%s\n" ,
1231
+ fprintf (o -> file , "%s%s--- %s%s%s\n" ,
1233
1232
line_prefix , meta , ecbdata -> label_path [0 ], reset , name_a_tab );
1234
- fprintf (ecbdata -> opt -> file , "%s%s+++ %s%s%s\n" ,
1233
+ fprintf (o -> file , "%s%s+++ %s%s%s\n" ,
1235
1234
line_prefix , meta , ecbdata -> label_path [1 ], reset , name_b_tab );
1236
1235
ecbdata -> label_path [0 ] = ecbdata -> label_path [1 ] = NULL ;
1237
1236
}
@@ -1249,15 +1248,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1249
1248
find_lno (line , ecbdata );
1250
1249
emit_hunk_header (ecbdata , line , len );
1251
1250
if (line [len - 1 ] != '\n' )
1252
- putc ('\n' , ecbdata -> opt -> file );
1253
- return ;
1254
- }
1255
-
1256
- if (len < 1 ) {
1257
- emit_line (ecbdata -> opt , reset , reset , line , len );
1258
- if (ecbdata -> diff_words
1259
- && ecbdata -> diff_words -> type == DIFF_WORDS_PORCELAIN )
1260
- fputs ("~\n" , ecbdata -> opt -> file );
1251
+ putc ('\n' , o -> file );
1261
1252
return ;
1262
1253
}
1263
1254
@@ -1282,8 +1273,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1282
1273
}
1283
1274
diff_words_flush (ecbdata );
1284
1275
if (ecbdata -> diff_words -> type == DIFF_WORDS_PORCELAIN ) {
1285
- emit_line (ecbdata -> opt , context , reset , line , len );
1286
- fputs ("~\n" , ecbdata -> opt -> file );
1276
+ emit_line (o , context , reset , line , len );
1277
+ fputs ("~\n" , o -> file );
1287
1278
} else {
1288
1279
/*
1289
1280
* Skip the prefix character, if any. With
@@ -1294,7 +1285,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1294
1285
line ++ ;
1295
1286
len -- ;
1296
1287
}
1297
- emit_line (ecbdata -> opt , context , reset , line , len );
1288
+ emit_line (o , context , reset , line , len );
1298
1289
}
1299
1290
return ;
1300
1291
}
@@ -1316,8 +1307,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1316
1307
default :
1317
1308
/* incomplete line at the end */
1318
1309
ecbdata -> lno_in_preimage ++ ;
1319
- emit_line (ecbdata -> opt ,
1320
- diff_get_color (ecbdata -> color_diff , DIFF_CONTEXT ),
1310
+ emit_line (o , diff_get_color (ecbdata -> color_diff , DIFF_CONTEXT ),
1321
1311
reset , line , len );
1322
1312
break ;
1323
1313
}
@@ -2438,7 +2428,6 @@ static void builtin_diff(const char *name_a,
2438
2428
memset (& ecbdata , 0 , sizeof (ecbdata ));
2439
2429
ecbdata .label_path = lbl ;
2440
2430
ecbdata .color_diff = want_color (o -> use_color );
2441
- ecbdata .found_changesp = & o -> found_changes ;
2442
2431
ecbdata .ws_rule = whitespace_rule (name_b );
2443
2432
if (ecbdata .ws_rule & WS_BLANK_AT_EOF )
2444
2433
check_blank_at_eof (& mf1 , & mf2 , & ecbdata );
0 commit comments