Skip to content

Commit f731814

Browse files
pcloudsgitster
authored andcommitted
diff-parseopt: convert -O
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 85f8e88 commit f731814

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

diff.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4617,22 +4617,6 @@ static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *va
46174617
return 1;
46184618
}
46194619

4620-
static inline int short_opt(char opt, const char **argv,
4621-
const char **optarg)
4622-
{
4623-
const char *arg = argv[0];
4624-
if (arg[0] != '-' || arg[1] != opt)
4625-
return 0;
4626-
if (arg[2] != '\0') {
4627-
*optarg = arg + 2;
4628-
return 1;
4629-
}
4630-
if (!argv[1])
4631-
die("Option '%c' requires a value", opt);
4632-
*optarg = argv[1];
4633-
return 2;
4634-
}
4635-
46364620
int parse_long_opt(const char *opt, const char **argv,
46374621
const char **optarg)
46384622
{
@@ -5397,6 +5381,8 @@ static void prep_parse_options(struct diff_options *options)
53975381
OPT_BIT_F(0, "pickaxe-regex", &options->pickaxe_opts,
53985382
N_("treat <string> in -S as extended POSIX regular expression"),
53995383
DIFF_PICKAXE_REGEX, PARSE_OPT_NONEG),
5384+
OPT_FILENAME('O', NULL, &options->orderfile,
5385+
N_("control the order in which files appear in the output")),
54005386
{ OPTION_CALLBACK, 0, "output", options, N_("<file>"),
54015387
N_("Output to a specific file"),
54025388
PARSE_OPT_NONEG, NULL, 0, diff_opt_output },
@@ -5449,10 +5435,7 @@ int diff_opt_parse(struct diff_options *options,
54495435
}
54505436

54515437
/* misc options */
5452-
else if ((argcount = short_opt('O', av, &optarg))) {
5453-
options->orderfile = prefix_filename(prefix, optarg);
5454-
return argcount;
5455-
} else if (skip_prefix(arg, "--find-object=", &arg))
5438+
else if (skip_prefix(arg, "--find-object=", &arg))
54565439
return parse_objfind_opt(options, arg);
54575440
else if ((argcount = parse_long_opt("diff-filter", av, &optarg))) {
54585441
int offending = parse_diff_filter_opt(optarg, options);

0 commit comments

Comments
 (0)