зеркало из https://github.com/microsoft/git.git
diff-parseopt: convert --[src|dst]-prefix
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
d877418390
Коммит
31fba9d3b4
14
diff.c
14
diff.c
|
@ -5255,6 +5255,12 @@ static void prep_parse_options(struct diff_options *options)
|
||||||
N_("do not munge pathnames and use NULs as output field terminators in --raw or --numstat"),
|
N_("do not munge pathnames and use NULs as output field terminators in --raw or --numstat"),
|
||||||
0),
|
0),
|
||||||
OPT__ABBREV(&options->abbrev),
|
OPT__ABBREV(&options->abbrev),
|
||||||
|
OPT_STRING_F(0, "src-prefix", &options->a_prefix, N_("<prefix>"),
|
||||||
|
N_("show the given source prefix instead of \"a/\""),
|
||||||
|
PARSE_OPT_NONEG),
|
||||||
|
OPT_STRING_F(0, "dst-prefix", &options->b_prefix, N_("<prefix>"),
|
||||||
|
N_("show the given source prefix instead of \"b/\""),
|
||||||
|
PARSE_OPT_NONEG),
|
||||||
OPT_CALLBACK_F(0, "output-indicator-new",
|
OPT_CALLBACK_F(0, "output-indicator-new",
|
||||||
&options->output_indicators[OUTPUT_INDICATOR_NEW],
|
&options->output_indicators[OUTPUT_INDICATOR_NEW],
|
||||||
N_("<char>"),
|
N_("<char>"),
|
||||||
|
@ -5449,20 +5455,12 @@ int diff_opt_parse(struct diff_options *options,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* misc options */
|
/* misc options */
|
||||||
else if ((argcount = parse_long_opt("src-prefix", av, &optarg))) {
|
|
||||||
options->a_prefix = optarg;
|
|
||||||
return argcount;
|
|
||||||
}
|
|
||||||
else if ((argcount = parse_long_opt("line-prefix", av, &optarg))) {
|
else if ((argcount = parse_long_opt("line-prefix", av, &optarg))) {
|
||||||
options->line_prefix = optarg;
|
options->line_prefix = optarg;
|
||||||
options->line_prefix_length = strlen(options->line_prefix);
|
options->line_prefix_length = strlen(options->line_prefix);
|
||||||
graph_setup_line_prefix(options);
|
graph_setup_line_prefix(options);
|
||||||
return argcount;
|
return argcount;
|
||||||
}
|
}
|
||||||
else if ((argcount = parse_long_opt("dst-prefix", av, &optarg))) {
|
|
||||||
options->b_prefix = optarg;
|
|
||||||
return argcount;
|
|
||||||
}
|
|
||||||
else if (!strcmp(arg, "--no-prefix"))
|
else if (!strcmp(arg, "--no-prefix"))
|
||||||
options->a_prefix = options->b_prefix = "";
|
options->a_prefix = options->b_prefix = "";
|
||||||
else if (opt_arg(arg, '\0', "inter-hunk-context",
|
else if (opt_arg(arg, '\0', "inter-hunk-context",
|
||||||
|
|
|
@ -136,6 +136,7 @@ struct option {
|
||||||
#define OPT_BOOL_F(s, l, v, h, f) OPT_SET_INT_F(s, l, v, h, 1, f)
|
#define OPT_BOOL_F(s, l, v, h, f) OPT_SET_INT_F(s, l, v, h, 1, f)
|
||||||
#define OPT_CALLBACK_F(s, l, v, a, h, f, cb) \
|
#define OPT_CALLBACK_F(s, l, v, a, h, f, cb) \
|
||||||
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), (cb) }
|
{ OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), (cb) }
|
||||||
|
#define OPT_STRING_F(s, l, v, a, h, f) { OPTION_STRING, (s), (l), (v), (a), (h), (f) }
|
||||||
|
|
||||||
#define OPT_END() { OPTION_END }
|
#define OPT_END() { OPTION_END }
|
||||||
#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, \
|
#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, \
|
||||||
|
@ -157,7 +158,7 @@ struct option {
|
||||||
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), N_("n"), (h) }
|
#define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), N_("n"), (h) }
|
||||||
#define OPT_MAGNITUDE(s, l, v, h) { OPTION_MAGNITUDE, (s), (l), (v), \
|
#define OPT_MAGNITUDE(s, l, v, h) { OPTION_MAGNITUDE, (s), (l), (v), \
|
||||||
N_("n"), (h), PARSE_OPT_NONEG }
|
N_("n"), (h), PARSE_OPT_NONEG }
|
||||||
#define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) }
|
#define OPT_STRING(s, l, v, a, h) OPT_STRING_F(s, l, v, a, h, 0)
|
||||||
#define OPT_STRING_LIST(s, l, v, a, h) \
|
#define OPT_STRING_LIST(s, l, v, a, h) \
|
||||||
{ OPTION_CALLBACK, (s), (l), (v), (a), \
|
{ OPTION_CALLBACK, (s), (l), (v), (a), \
|
||||||
(h), 0, &parse_opt_string_list }
|
(h), 0, &parse_opt_string_list }
|
||||||
|
|
Загрузка…
Ссылка в новой задаче