@@ -2340,7 +2340,7 @@ static void find_lno(const char *line, struct emit_callback *ecbdata)
2340
2340
ecbdata -> lno_in_postimage = strtol (p + 1 , NULL , 10 );
2341
2341
}
2342
2342
2343
- static void fn_out_consume (void * priv , char * line , unsigned long len )
2343
+ static int fn_out_consume (void * priv , char * line , unsigned long len )
2344
2344
{
2345
2345
struct emit_callback * ecbdata = priv ;
2346
2346
struct diff_options * o = ecbdata -> opt ;
@@ -2376,7 +2376,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
2376
2376
len = sane_truncate_line (line , len );
2377
2377
find_lno (line , ecbdata );
2378
2378
emit_hunk_header (ecbdata , line , len );
2379
- return ;
2379
+ return 0 ;
2380
2380
}
2381
2381
2382
2382
if (ecbdata -> diff_words ) {
@@ -2386,11 +2386,11 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
2386
2386
if (line [0 ] == '-' ) {
2387
2387
diff_words_append (line , len ,
2388
2388
& ecbdata -> diff_words -> minus );
2389
- return ;
2389
+ return 0 ;
2390
2390
} else if (line [0 ] == '+' ) {
2391
2391
diff_words_append (line , len ,
2392
2392
& ecbdata -> diff_words -> plus );
2393
- return ;
2393
+ return 0 ;
2394
2394
} else if (starts_with (line , "\\ " )) {
2395
2395
/*
2396
2396
* Eat the "no newline at eof" marker as if we
@@ -2399,11 +2399,11 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
2399
2399
* defer processing. If this is the end of
2400
2400
* preimage, more "+" lines may come after it.
2401
2401
*/
2402
- return ;
2402
+ return 0 ;
2403
2403
}
2404
2404
diff_words_flush (ecbdata );
2405
2405
emit_diff_symbol (o , s , line , len , 0 );
2406
- return ;
2406
+ return 0 ;
2407
2407
}
2408
2408
2409
2409
switch (line [0 ]) {
@@ -2427,6 +2427,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
2427
2427
line , len , 0 );
2428
2428
break ;
2429
2429
}
2430
+ return 0 ;
2430
2431
}
2431
2432
2432
2433
static void pprint_rename (struct strbuf * name , const char * a , const char * b )
@@ -2526,7 +2527,7 @@ static struct diffstat_file *diffstat_add(struct diffstat_t *diffstat,
2526
2527
return x ;
2527
2528
}
2528
2529
2529
- static void diffstat_consume (void * priv , char * line , unsigned long len )
2530
+ static int diffstat_consume (void * priv , char * line , unsigned long len )
2530
2531
{
2531
2532
struct diffstat_t * diffstat = priv ;
2532
2533
struct diffstat_file * x = diffstat -> files [diffstat -> nr - 1 ];
@@ -2535,6 +2536,7 @@ static void diffstat_consume(void *priv, char *line, unsigned long len)
2535
2536
x -> added ++ ;
2536
2537
else if (line [0 ] == '-' )
2537
2538
x -> deleted ++ ;
2539
+ return 0 ;
2538
2540
}
2539
2541
2540
2542
const char mime_boundary_leader [] = "------------" ;
@@ -3212,7 +3214,7 @@ static void checkdiff_consume_hunk(void *priv,
3212
3214
data -> lineno = nb - 1 ;
3213
3215
}
3214
3216
3215
- static void checkdiff_consume (void * priv , char * line , unsigned long len )
3217
+ static int checkdiff_consume (void * priv , char * line , unsigned long len )
3216
3218
{
3217
3219
struct checkdiff_t * data = priv ;
3218
3220
int marker_size = data -> conflict_marker_size ;
@@ -3236,7 +3238,7 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
3236
3238
}
3237
3239
bad = ws_check (line + 1 , len - 1 , data -> ws_rule );
3238
3240
if (!bad )
3239
- return ;
3241
+ return 0 ;
3240
3242
data -> status |= bad ;
3241
3243
err = whitespace_error_string (bad );
3242
3244
fprintf (data -> o -> file , "%s%s:%d: %s.\n" ,
@@ -3248,6 +3250,7 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
3248
3250
} else if (line [0 ] == ' ' ) {
3249
3251
data -> lineno ++ ;
3250
3252
}
3253
+ return 0 ;
3251
3254
}
3252
3255
3253
3256
static unsigned char * deflate_it (char * data ,
@@ -3726,7 +3729,8 @@ static void builtin_diffstat(const char *name_a, const char *name_b,
3726
3729
xpp .anchors_nr = o -> anchors_nr ;
3727
3730
xecfg .ctxlen = o -> context ;
3728
3731
xecfg .interhunkctxlen = o -> interhunkcontext ;
3729
- if (xdi_diff_outf (& mf1 , & mf2 , discard_hunk_line ,
3732
+ xecfg .flags = XDL_EMIT_NO_HUNK_HDR ;
3733
+ if (xdi_diff_outf (& mf1 , & mf2 , NULL ,
3730
3734
diffstat_consume , diffstat , & xpp , & xecfg ))
3731
3735
die ("unable to generate diffstat for %s" , one -> path );
3732
3736
@@ -4632,6 +4636,12 @@ void diff_setup_done(struct diff_options *options)
4632
4636
if (HAS_MULTI_BITS (options -> pickaxe_opts & DIFF_PICKAXE_KINDS_MASK ))
4633
4637
die (_ ("-G, -S and --find-object are mutually exclusive" ));
4634
4638
4639
+ if (HAS_MULTI_BITS (options -> pickaxe_opts & DIFF_PICKAXE_KINDS_G_REGEX_MASK ))
4640
+ die (_ ("-G and --pickaxe-regex are mutually exclusive, use --pickaxe-regex with -S" ));
4641
+
4642
+ if (HAS_MULTI_BITS (options -> pickaxe_opts & DIFF_PICKAXE_KINDS_ALL_OBJFIND_MASK ))
4643
+ die (_ ("---pickaxe-all and --find-object are mutually exclusive, use --pickaxe-all with -G and -S" ));
4644
+
4635
4645
/*
4636
4646
* Most of the time we can say "there are changes"
4637
4647
* only by checking if there are changed paths, but
@@ -6119,17 +6129,18 @@ void flush_one_hunk(struct object_id *result, git_hash_ctx *ctx)
6119
6129
}
6120
6130
}
6121
6131
6122
- static void patch_id_consume (void * priv , char * line , unsigned long len )
6132
+ static int patch_id_consume (void * priv , char * line , unsigned long len )
6123
6133
{
6124
6134
struct patch_id_t * data = priv ;
6125
6135
int new_len ;
6126
6136
6127
6137
if (len > 12 && starts_with (line , "\\ " ))
6128
- return ;
6138
+ return 0 ;
6129
6139
new_len = remove_space (line , len );
6130
6140
6131
6141
the_hash_algo -> update_fn (data -> ctx , line , new_len );
6132
6142
data -> patchlen += new_len ;
6143
+ return 0 ;
6133
6144
}
6134
6145
6135
6146
static void patch_id_add_string (git_hash_ctx * ctx , const char * str )
@@ -6227,8 +6238,8 @@ static int diff_get_patch_id(struct diff_options *options, struct object_id *oid
6227
6238
6228
6239
xpp .flags = 0 ;
6229
6240
xecfg .ctxlen = 3 ;
6230
- xecfg .flags = 0 ;
6231
- if (xdi_diff_outf (& mf1 , & mf2 , discard_hunk_line ,
6241
+ xecfg .flags = XDL_EMIT_NO_HUNK_HDR ;
6242
+ if (xdi_diff_outf (& mf1 , & mf2 , NULL ,
6232
6243
patch_id_consume , & data , & xpp , & xecfg ))
6233
6244
return error ("unable to generate patch-id diff for %s" ,
6234
6245
p -> one -> path );
0 commit comments