Skip to content

Commit fa518ae

Browse files
rscharfegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1241800 commit fa518ae

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

revision.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,8 +3036,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
30363036
revs->grep_filter.ignore_locale = 1;
30373037
compile_grep_patterns(&revs->grep_filter);
30383038

3039-
if (revs->reverse && revs->reflog_info)
3040-
die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs");
30413039
if (revs->reflog_info && revs->limited)
30423040
die("cannot combine --walk-reflogs with history-limiting options");
30433041
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
30483046
/*
30493047
* Limitations on the graph functionality
30503048
*/
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");
30533052

3054-
if (revs->reflog_info && revs->graph)
3055-
die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph");
30563053
if (revs->no_walk && revs->graph)
30573054
die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
30583055
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)

0 commit comments

Comments
 (0)