mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'so/diff-merges-cleanup' into maint-2.38
Code clean-up. * so/diff-merges-cleanup: diff-merges: clarify log.diffMerges documentation diff-merges: cleanup set_diff_merges() diff-merges: cleanup func_by_opt()
This commit is contained in:
commit
1b97c136cc
|
@ -34,9 +34,9 @@ log.excludeDecoration::
|
|||
option.
|
||||
|
||||
log.diffMerges::
|
||||
Set default diff format to be used for merge commits. See
|
||||
`--diff-merges` in linkgit:git-log[1] for details.
|
||||
Defaults to `separate`.
|
||||
Set diff format to be used when `--diff-merges=on` is
|
||||
specified, see `--diff-merges` in linkgit:git-log[1] for
|
||||
details. Defaults to `separate`.
|
||||
|
||||
log.follow::
|
||||
If `true`, `git log` will act as if the `--follow` option was used when
|
||||
|
|
|
@ -20,9 +20,20 @@ static void suppress(struct rev_info *revs)
|
|||
revs->remerge_diff = 0;
|
||||
}
|
||||
|
||||
static void set_separate(struct rev_info *revs)
|
||||
static void common_setup(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
revs->merges_need_diff = 1;
|
||||
}
|
||||
|
||||
static void set_none(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
}
|
||||
|
||||
static void set_separate(struct rev_info *revs)
|
||||
{
|
||||
common_setup(revs);
|
||||
revs->separate_merges = 1;
|
||||
revs->simplify_history = 0;
|
||||
}
|
||||
|
@ -35,21 +46,21 @@ static void set_first_parent(struct rev_info *revs)
|
|||
|
||||
static void set_combined(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
common_setup(revs);
|
||||
revs->combine_merges = 1;
|
||||
revs->dense_combined_merges = 0;
|
||||
}
|
||||
|
||||
static void set_dense_combined(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
common_setup(revs);
|
||||
revs->combine_merges = 1;
|
||||
revs->dense_combined_merges = 1;
|
||||
}
|
||||
|
||||
static void set_remerge_diff(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
common_setup(revs);
|
||||
revs->remerge_diff = 1;
|
||||
revs->simplify_history = 0;
|
||||
}
|
||||
|
@ -57,18 +68,18 @@ static void set_remerge_diff(struct rev_info *revs)
|
|||
static diff_merges_setup_func_t func_by_opt(const char *optarg)
|
||||
{
|
||||
if (!strcmp(optarg, "off") || !strcmp(optarg, "none"))
|
||||
return suppress;
|
||||
return set_none;
|
||||
if (!strcmp(optarg, "1") || !strcmp(optarg, "first-parent"))
|
||||
return set_first_parent;
|
||||
else if (!strcmp(optarg, "separate"))
|
||||
if (!strcmp(optarg, "separate"))
|
||||
return set_separate;
|
||||
else if (!strcmp(optarg, "c") || !strcmp(optarg, "combined"))
|
||||
if (!strcmp(optarg, "c") || !strcmp(optarg, "combined"))
|
||||
return set_combined;
|
||||
else if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined"))
|
||||
if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined"))
|
||||
return set_dense_combined;
|
||||
else if (!strcmp(optarg, "r") || !strcmp(optarg, "remerge"))
|
||||
if (!strcmp(optarg, "r") || !strcmp(optarg, "remerge"))
|
||||
return set_remerge_diff;
|
||||
else if (!strcmp(optarg, "m") || !strcmp(optarg, "on"))
|
||||
if (!strcmp(optarg, "m") || !strcmp(optarg, "on"))
|
||||
return set_to_default;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -81,10 +92,6 @@ static void set_diff_merges(struct rev_info *revs, const char *optarg)
|
|||
die(_("invalid value for '%s': '%s'"), "--diff-merges", optarg);
|
||||
|
||||
func(revs);
|
||||
|
||||
/* NOTE: the merges_need_diff flag is cleared by func() call */
|
||||
if (func != suppress)
|
||||
revs->merges_need_diff = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -115,6 +122,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
|||
|
||||
if (!suppress_m_parsing && !strcmp(arg, "-m")) {
|
||||
set_to_default(revs);
|
||||
revs->merges_need_diff = 0;
|
||||
} else if (!strcmp(arg, "-c")) {
|
||||
set_combined(revs);
|
||||
revs->merges_imply_patch = 1;
|
||||
|
@ -125,7 +133,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
|||
set_remerge_diff(revs);
|
||||
revs->merges_imply_patch = 1;
|
||||
} else if (!strcmp(arg, "--no-diff-merges")) {
|
||||
suppress(revs);
|
||||
set_none(revs);
|
||||
} else if (!strcmp(arg, "--combined-all-paths")) {
|
||||
revs->combined_all_paths = 1;
|
||||
} else if ((argcount = parse_long_opt("diff-merges", argv, &optarg))) {
|
||||
|
@ -139,7 +147,7 @@ int diff_merges_parse_opts(struct rev_info *revs, const char **argv)
|
|||
|
||||
void diff_merges_suppress(struct rev_info *revs)
|
||||
{
|
||||
suppress(revs);
|
||||
set_none(revs);
|
||||
}
|
||||
|
||||
void diff_merges_default_to_first_parent(struct rev_info *revs)
|
||||
|
|
Loading…
Reference in a new issue