@@ -4799,12 +4799,15 @@ static int diff_opt_ws_error_highlight(const struct option *option,
4799
4799
return 0 ;
4800
4800
}
4801
4801
4802
- static int parse_objfind_opt (struct diff_options * opt , const char * arg )
4802
+ static int diff_opt_find_object (const struct option * option ,
4803
+ const char * arg , int unset )
4803
4804
{
4805
+ struct diff_options * opt = option -> value ;
4804
4806
struct object_id oid ;
4805
4807
4808
+ BUG_ON_OPT_NEG (unset );
4806
4809
if (get_oid (arg , & oid ))
4807
- return error ("unable to resolve '%s'" , arg );
4810
+ return error (_ ( "unable to resolve '%s'" ) , arg );
4808
4811
4809
4812
if (!opt -> objfind )
4810
4813
opt -> objfind = xcalloc (1 , sizeof (* opt -> objfind ));
@@ -4813,7 +4816,7 @@ static int parse_objfind_opt(struct diff_options *opt, const char *arg)
4813
4816
opt -> flags .recursive = 1 ;
4814
4817
opt -> flags .tree_in_recursive = 1 ;
4815
4818
oidset_insert (opt -> objfind , & oid );
4816
- return 1 ;
4819
+ return 0 ;
4817
4820
}
4818
4821
4819
4822
static int diff_opt_anchored (const struct option * opt ,
@@ -5383,6 +5386,9 @@ static void prep_parse_options(struct diff_options *options)
5383
5386
DIFF_PICKAXE_REGEX , PARSE_OPT_NONEG ),
5384
5387
OPT_FILENAME ('O' , NULL , & options -> orderfile ,
5385
5388
N_ ("control the order in which files appear in the output" )),
5389
+ OPT_CALLBACK_F (0 , "find-object" , options , N_ ("<object-id>" ),
5390
+ N_ ("look for differences that change the number of occurrences of the specified object" ),
5391
+ PARSE_OPT_NONEG , diff_opt_find_object ),
5386
5392
{ OPTION_CALLBACK , 0 , "output" , options , N_ ("<file>" ),
5387
5393
N_ ("Output to a specific file" ),
5388
5394
PARSE_OPT_NONEG , NULL , 0 , diff_opt_output },
@@ -5435,8 +5441,6 @@ int diff_opt_parse(struct diff_options *options,
5435
5441
}
5436
5442
5437
5443
/* misc options */
5438
- else if (skip_prefix (arg , "--find-object=" , & arg ))
5439
- return parse_objfind_opt (options , arg );
5440
5444
else if ((argcount = parse_long_opt ("diff-filter" , av , & optarg ))) {
5441
5445
int offending = parse_diff_filter_opt (optarg , options );
5442
5446
if (offending )
0 commit comments