Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-02-05 17:46:11 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-07 08:14:31 +0300
commitf1ce6c191e9d15ce78041d8b6496c246b10d9b2d (patch)
treebd2e245ebc24622e25b7b1f0c1fbe821719ab4dc /builtin/range-diff.c
parent5189bb87249434fba3a82f17b2bc6c93025ba88d (diff)
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.c13
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);