@@ -5056,6 +5056,28 @@ static int diff_opt_patience(const struct option *opt,
5056
5056
return 0 ;
5057
5057
}
5058
5058
5059
+ static int diff_opt_pickaxe_regex (const struct option * opt ,
5060
+ const char * arg , int unset )
5061
+ {
5062
+ struct diff_options * options = opt -> value ;
5063
+
5064
+ BUG_ON_OPT_NEG (unset );
5065
+ options -> pickaxe = arg ;
5066
+ options -> pickaxe_opts |= DIFF_PICKAXE_KIND_G ;
5067
+ return 0 ;
5068
+ }
5069
+
5070
+ static int diff_opt_pickaxe_string (const struct option * opt ,
5071
+ const char * arg , int unset )
5072
+ {
5073
+ struct diff_options * options = opt -> value ;
5074
+
5075
+ BUG_ON_OPT_NEG (unset );
5076
+ options -> pickaxe = arg ;
5077
+ options -> pickaxe_opts |= DIFF_PICKAXE_KIND_S ;
5078
+ return 0 ;
5079
+ }
5080
+
5059
5081
static int diff_opt_relative (const struct option * opt ,
5060
5082
const char * arg , int unset )
5061
5083
{
@@ -5363,6 +5385,12 @@ static void prep_parse_options(struct diff_options *options)
5363
5385
OPT_SET_INT_F (0 , "ita-visible-in-index" , & options -> ita_invisible_in_index ,
5364
5386
N_ ("treat 'git add -N' entries as real in the index" ),
5365
5387
0 , PARSE_OPT_NONEG ),
5388
+ OPT_CALLBACK_F ('S' , NULL , options , N_ ("<string>" ),
5389
+ N_ ("look for differences that change the number of occurrences of the specified string" ),
5390
+ 0 , diff_opt_pickaxe_string ),
5391
+ OPT_CALLBACK_F ('G' , NULL , options , N_ ("<regex>" ),
5392
+ N_ ("look for differences that change the number of occurrences of the specified regex" ),
5393
+ 0 , diff_opt_pickaxe_regex ),
5366
5394
{ OPTION_CALLBACK , 0 , "output" , options , N_ ("<file>" ),
5367
5395
N_ ("Output to a specific file" ),
5368
5396
PARSE_OPT_NONEG , NULL , 0 , diff_opt_output },
@@ -5415,15 +5443,6 @@ int diff_opt_parse(struct diff_options *options,
5415
5443
}
5416
5444
5417
5445
/* misc options */
5418
- else if ((argcount = short_opt ('S' , av , & optarg ))) {
5419
- options -> pickaxe = optarg ;
5420
- options -> pickaxe_opts |= DIFF_PICKAXE_KIND_S ;
5421
- return argcount ;
5422
- } else if ((argcount = short_opt ('G' , av , & optarg ))) {
5423
- options -> pickaxe = optarg ;
5424
- options -> pickaxe_opts |= DIFF_PICKAXE_KIND_G ;
5425
- return argcount ;
5426
- }
5427
5446
else if (!strcmp (arg , "--pickaxe-all" ))
5428
5447
options -> pickaxe_opts |= DIFF_PICKAXE_ALL ;
5429
5448
else if (!strcmp (arg , "--pickaxe-regex" ))
0 commit comments