diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-05 14:46:11 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-06 21:14:31 -0800 |
commit | f1ce6c191e9d15ce78041d8b6496c246b10d9b2d (patch) | |
tree | bd2e245ebc24622e25b7b1f0c1fbe821719ab4dc /builtin/range-diff.c | |
parent | range-diff: simplify code spawning `git log` (diff) | |
download | tgif-f1ce6c191e9d15ce78041d8b6496c246b10d9b2d.tar.xz |
range-diff: combine all options in a single data structure
This will make it easier to implement the `--left-only` and
`--right-only` options.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/range-diff.c')
-rw-r--r-- | builtin/range-diff.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 24c4162f74..73fea79601 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -13,12 +13,17 @@ NULL int cmd_range_diff(int argc, const char **argv, const char *prefix) { - int creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT; struct diff_options diffopt = { NULL }; struct strvec other_arg = STRVEC_INIT; + struct range_diff_options range_diff_opts = { + .creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT, + .diffopt = &diffopt, + .other_arg = &other_arg + }; int simple_color = -1; struct option range_diff_options[] = { - OPT_INTEGER(0, "creation-factor", &creation_factor, + OPT_INTEGER(0, "creation-factor", + &range_diff_opts.creation_factor, N_("Percentage by which creation is weighted")), OPT_BOOL(0, "no-dual-color", &simple_color, N_("use simple diff colors")), @@ -81,8 +86,8 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix) } FREE_AND_NULL(options); - res = show_range_diff(range1.buf, range2.buf, creation_factor, - simple_color < 1, &diffopt, &other_arg); + range_diff_opts.dual_color = simple_color < 1; + res = show_range_diff(range1.buf, range2.buf, &range_diff_opts); strvec_clear(&other_arg); strbuf_release(&range1); |