Skip to content

Commit e031fa1

Browse files
edith007gitster
authored andcommitted
replay: use die_for_incompatible_opt2() for option validation
In preparation for adding the --ref-action option, convert option validation to use die_for_incompatible_opt2(). This helper provides standardized error messages for mutually exclusive options. The following commit introduces --ref-action which will be incompatible with certain other options. Using die_for_incompatible_opt2() now means that commit can cleanly add its validation using the same pattern, keeping the validation logic consistent and maintainable. This also aligns git-replay's option handling with how other Git commands manage option conflicts, using the established die_for_incompatible_opt*() helper family. Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent bb69721 commit e031fa1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/replay.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ int cmd_replay(int argc,
330330
usage_with_options(replay_usage, replay_options);
331331
}
332332

333-
if (advance_name_opt && contained)
334-
die(_("options '%s' and '%s' cannot be used together"),
335-
"--advance", "--contained");
333+
die_for_incompatible_opt2(!!advance_name_opt, "--advance",
334+
contained, "--contained");
335+
336336
advance_name = xstrdup_or_null(advance_name_opt);
337337

338338
repo_init_revisions(repo, &revs, prefix);

0 commit comments

Comments
 (0)