i18n: factorize more 'incompatible options' messages
Find more incompatible options to factorize. When more than two options are mutually exclusive, print the ones which are actually on the command line. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
5d01301f2b
commit
a699367bb8
@ -1242,8 +1242,6 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
||||
struct commit *current_head,
|
||||
struct wt_status *s)
|
||||
{
|
||||
int f = 0;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
||||
finalize_deferred_config(s);
|
||||
|
||||
@ -1251,7 +1249,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
||||
force_author = find_author_by_nickname(force_author);
|
||||
|
||||
if (force_author && renew_authorship)
|
||||
die(_("Using both --reset-author and --author does not make sense"));
|
||||
die(_("options '%s' and '%s' cannot be used together"), "--reset-author", "--author");
|
||||
|
||||
if (logfile || have_option_m || use_message)
|
||||
use_editor = 0;
|
||||
@ -1268,20 +1266,16 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
||||
die(_("You are in the middle of a rebase -- cannot amend."));
|
||||
}
|
||||
if (fixup_message && squash_message)
|
||||
die(_("Options --squash and --fixup cannot be used together"));
|
||||
if (use_message)
|
||||
f++;
|
||||
if (edit_message)
|
||||
f++;
|
||||
if (fixup_message)
|
||||
f++;
|
||||
if (logfile)
|
||||
f++;
|
||||
if (f > 1)
|
||||
die(_("Only one of -c/-C/-F/--fixup can be used."));
|
||||
if (have_option_m && (edit_message || use_message || logfile))
|
||||
die((_("Option -m cannot be combined with -c/-C/-F.")));
|
||||
if (f || have_option_m)
|
||||
die(_("options '%s' and '%s' cannot be used together"), "--squash", "--fixup");
|
||||
die_for_incompatible_opt4(!!use_message, "-C",
|
||||
!!edit_message, "-c",
|
||||
!!logfile, "-F",
|
||||
!!fixup_message, "--fixup");
|
||||
die_for_incompatible_opt4(have_option_m, "-m",
|
||||
!!edit_message, "-c",
|
||||
!!use_message, "-C",
|
||||
!!logfile, "-F");
|
||||
if (use_message || edit_message || logfile ||fixup_message || have_option_m)
|
||||
template_file = NULL;
|
||||
if (edit_message)
|
||||
use_message = edit_message;
|
||||
@ -1306,9 +1300,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
||||
if (patch_interactive)
|
||||
interactive = 1;
|
||||
|
||||
if (also + only + all + interactive > 1)
|
||||
die(_("Only one of --include/--only/--all/--interactive/--patch can be used."));
|
||||
|
||||
die_for_incompatible_opt4(also, "-i/--include",
|
||||
only, "-o/--only",
|
||||
all, "-a/--all",
|
||||
interactive, "--interactive/-p/--patch");
|
||||
if (fixup_message) {
|
||||
/*
|
||||
* We limit --fixup's suboptions to only alpha characters.
|
||||
|
Reference in New Issue
Block a user