From 299a66344065583162518cd8b65e2b91132eb1ac Mon Sep 17 00:00:00 2001 From: Sergey Organov Date: Mon, 21 Dec 2020 18:19:30 +0300 Subject: revision: factor out setup of diff-merge related settings Move all the setting code related to diffing merges into new setup_diff_merge_revs() function. Signed-off-by: Sergey Organov Signed-off-by: Junio C Hamano --- revision.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'revision.c') diff --git a/revision.c b/revision.c index 8b17cfd754..d818e0b18b 100644 --- a/revision.c +++ b/revision.c @@ -2192,6 +2192,16 @@ static int parse_diff_merge_opts(struct rev_info *revs, const char **argv) return argcount; } +static void setup_diff_merges_revs(struct rev_info *revs) +{ + if (revs->combine_merges && revs->ignore_merges < 0) + revs->ignore_merges = 0; + if (revs->ignore_merges < 0) + revs->ignore_merges = 1; + if (revs->combined_all_paths && !revs->combine_merges) + die("--combined-all-paths makes no sense without -c or --cc"); +} + static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv, int *unkc, const char **unkv, const struct setup_revision_opt* opt) @@ -2886,12 +2896,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s copy_pathspec(&revs->diffopt.pathspec, &revs->prune_data); } - if (revs->combine_merges && revs->ignore_merges < 0) - revs->ignore_merges = 0; - if (revs->ignore_merges < 0) - revs->ignore_merges = 1; - if (revs->combined_all_paths && !revs->combine_merges) - die("--combined-all-paths makes no sense without -c or --cc"); + + setup_diff_merges_revs(revs); revs->diffopt.abbrev = revs->abbrev; -- cgit v1.2.3