revision: use die_for_incompatible_opt3() for - -graph/--reverse/--walk-reflogs

The revision option --reverse is incompatible with --walk-reflogs and --graph is incompatible with both --reverse and --walk-reflogs. So they are all incompatible with each other. Use the function for checking three mutually incompatible options, die_for_incompatible_opt3(), to perform this check in one place and without repetition. This is shorter and clearer. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Dec 6, 2023 at 12:51 UTC fa518aef564a24649ee6d8bbb29ed9c183a4b7c5
1 file changed +3 -6
revision.c
+3 -6
@@ -3036,8 +3036,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
3036 revs->grep_filter.ignore_locale = 1;
3037 compile_grep_patterns(&revs->grep_filter);
3038
3039 - if (revs->reverse && revs->reflog_info)
3040 - die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs");
3039 if (revs->reflog_info && revs->limited)
3040 die("cannot combine --walk-reflogs with history-limiting options");
3041 if (revs->rewrite_parents && revs->children.name)
@@ -3048,11 +3046,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
3046 /*
3047 * Limitations on the graph functionality
3048 */
3051 - if (revs->reverse && revs->graph)
3052 - die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--graph");
3049 + die_for_incompatible_opt3(!!revs->graph, "--graph",
3050 + !!revs->reverse, "--reverse",
3051 + !!revs->reflog_info, "--walk-reflogs");
3052
3054 - if (revs->reflog_info && revs->graph)
3055 - die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph");
3053 if (revs->no_walk && revs->graph)
3054 die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
3055 if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)