summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-03-24 08:20:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-24 13:21:23 (GMT)
commit31fba9d3b4d37518be3261af430f81af375de16e (patch)
treeb7d08bb3f250a8e1bd9140fac86ffed5933e8e3b /diff.c
parentd877418390168c9696fd46d5e78ca3362f26f74c (diff)
downloadgit-31fba9d3b4d37518be3261af430f81af375de16e.zip
git-31fba9d3b4d37518be3261af430f81af375de16e.tar.gz
git-31fba9d3b4d37518be3261af430f81af375de16e.tar.bz2
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>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/diff.c b/diff.c
index 8d38728..574fc51 100644
--- a/diff.c
+++ b/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"),
0),
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",
&options->output_indicators[OUTPUT_INDICATOR_NEW],
N_("<char>"),
@@ -5449,20 +5455,12 @@ int diff_opt_parse(struct diff_options *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))) {
options->line_prefix = optarg;
options->line_prefix_length = strlen(options->line_prefix);
graph_setup_line_prefix(options);
return argcount;
}
- else if ((argcount = parse_long_opt("dst-prefix", av, &optarg))) {
- options->b_prefix = optarg;
- return argcount;
- }
else if (!strcmp(arg, "--no-prefix"))
options->a_prefix = options->b_prefix = "";
else if (opt_arg(arg, '\0', "inter-hunk-context",