Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff-parseopt: convert --ws-error-highlight
author
Nguyễn Thái Ngọc Duy
<pclouds@gmail.com>
Sun, 24 Mar 2019 08:19:55 +0000
(15:19 +0700)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 24 Mar 2019 13:21:21 +0000
(22:21 +0900)
Mark one more string for translation while at there.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
125dcea
)
diff --git
a/diff.c
b/diff.c
index ce118bb326bfb429cacd6100bb1c7bf2d9fb521b..7bfdf081378c2460c1f36616f25bed557d1ab012 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-4801,17
+4801,18
@@
static void enable_patch_output(int *fmt)
*fmt |= DIFF_FORMAT_PATCH;
}
*fmt |= DIFF_FORMAT_PATCH;
}
-static int parse_ws_error_highlight_opt(struct diff_options *opt, const char *arg)
+static int diff_opt_ws_error_highlight(const struct option *option,
+ const char *arg, int unset)
{
{
+ struct diff_options *opt = option->value;
int val = parse_ws_error_highlight(arg);
int val = parse_ws_error_highlight(arg);
- if (val < 0) {
- error("unknown value after ws-error-highlight=%.*s",
- -1 - val, arg);
- return 0;
- }
+ BUG_ON_OPT_NEG(unset);
+ if (val < 0)
+ return error(_("unknown value after ws-error-highlight=%.*s"),
+ -1 - val, arg);
opt->ws_error_highlight = val;
opt->ws_error_highlight = val;
- return
1
;
+ return
0
;
}
static int parse_objfind_opt(struct diff_options *opt, const char *arg)
}
static int parse_objfind_opt(struct diff_options *opt, const char *arg)
@@
-5234,6
+5235,9
@@
static void prep_parse_options(struct diff_options *options)
N_("show full pre- and post-image object names on the \"index\" lines")),
OPT_COLOR_FLAG(0, "color", &options->use_color,
N_("show colored diff")),
N_("show full pre- and post-image object names on the \"index\" lines")),
OPT_COLOR_FLAG(0, "color", &options->use_color,
N_("show colored diff")),
+ OPT_CALLBACK_F(0, "ws-error-highlight", options, N_("<kind>"),
+ N_("highlight whitespace errors in the 'context', 'old' or 'new' lines in the diff"),
+ PARSE_OPT_NONEG, diff_opt_ws_error_highlight),
OPT_CALLBACK_F(0, "output-indicator-new",
&options->output_indicators[OUTPUT_INDICATOR_NEW],
N_("<char>"),
OPT_CALLBACK_F(0, "output-indicator-new",
&options->output_indicators[OUTPUT_INDICATOR_NEW],
N_("<char>"),
@@
-5397,9
+5401,7
@@
int diff_opt_parse(struct diff_options *options,
if (cm & COLOR_MOVED_WS_ERROR)
return -1;
options->color_moved_ws_handling = cm;
if (cm & COLOR_MOVED_WS_ERROR)
return -1;
options->color_moved_ws_handling = cm;
- } else if (skip_prefix(arg, "--ws-error-highlight=", &arg))
- return parse_ws_error_highlight_opt(options, arg);
- else if (!strcmp(arg, "--ita-invisible-in-index"))
+ } else if (!strcmp(arg, "--ita-invisible-in-index"))
options->ita_invisible_in_index = 1;
else if (!strcmp(arg, "--ita-visible-in-index"))
options->ita_invisible_in_index = 0;
options->ita_invisible_in_index = 1;
else if (!strcmp(arg, "--ita-visible-in-index"))
options->ita_invisible_in_index = 0;