i18n: refactor "foo and bar are mutually exclusive"

Use static strings for constant parts of the sentences. They are all
turned into "cannot be used together".

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jean-Noël Avila 2022-01-05 20:02:14 +00:00 committed by Junio C Hamano
parent 2ae0a9cb82
commit 43ea635c35
10 changed files with 13 additions and 13 deletions

View File

@ -1639,7 +1639,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
cb_option, toupper(cb_option));
if (opts->overlay_mode == 1 && opts->patch_mode)
die(_("-p and --overlay are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "-p", "--overlay");
if (opts->checkout_index >= 0 || opts->checkout_worktree >= 0) {
if (opts->checkout_index < 0)

View File

@ -152,7 +152,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
}
if (read_stdin && merge_base)
die(_("--stdin and --merge-base are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--stdin", "--merge-base");
if (merge_base && opt->pending.nr != 2)
die(_("--merge-base only works with two commits"));

View File

@ -2028,12 +2028,12 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
if (deepen_relative < 0)
die(_("negative depth in --deepen is not supported"));
if (depth)
die(_("--deepen and --depth are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--deepen", "--depth");
depth = xstrfmt("%d", deepen_relative);
}
if (unshallow) {
if (depth)
die(_("--depth and --unshallow cannot be used together"));
die(_("options '%s' and '%s' cannot be used together"), "--depth", "--unshallow");
else if (!is_repository_shallow(the_repository))
die(_("--unshallow on a complete repository does not make sense"));
else

View File

@ -557,7 +557,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
if (real_git_dir && is_bare_repository_cfg == 1)
die(_("--separate-git-dir and --bare are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--separate-git-dir", "--bare");
if (real_git_dir && !is_absolute_path(real_git_dir))
real_git_dir = real_pathdup(real_git_dir, 1);

View File

@ -1943,9 +1943,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
numbered = 0;
if (numbered && keep_subject)
die(_("-n and -k are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "-n", "-k");
if (keep_subject && subject_prefix)
die(_("--subject-prefix/--rfc and -k are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--subject-prefix/--rfc", "-k");
rev.preserve_subject = keep_subject;
argc = setup_revisions(argc, argv, &rev, &s_r_opt);

View File

@ -1313,7 +1313,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
if (files) {
if (cached)
die(_("--cached and --files are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--cached", "--files");
diff_cmd = DIFF_FILES;
}
@ -2972,7 +2972,7 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
die(_("--branch or --default required"));
if (opt_branch && opt_default)
die(_("--branch and --default are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--branch", "--default");
if (argc != 1 || !(path = argv[0]))
usage_with_options(usage, options);

View File

@ -699,7 +699,7 @@ static int list(int ac, const char **av, const char *prefix)
if (ac)
usage_with_options(worktree_usage, options);
else if (verbose && porcelain)
die(_("--verbose and --porcelain are mutually exclusive"));
die(_("options '%s' and '%s' cannot be used together"), "--verbose", "--porcelain");
else {
struct worktree **worktrees = get_worktrees();
int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;

View File

@ -556,7 +556,7 @@ int show_range_diff(const char *range1, const char *range2,
struct string_list branch2 = STRING_LIST_INIT_DUP;
if (range_diff_opts->left_only && range_diff_opts->right_only)
res = error(_("--left-only and --right-only are mutually exclusive"));
res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only");
if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg))
res = error(_("could not parse log for '%s'"), range1);

View File

@ -331,7 +331,7 @@ test_expect_success 'init with separate gitdir' '
test_expect_success 'explicit bare & --separate-git-dir incompatible' '
test_must_fail git init --bare --separate-git-dir goop.git bare.git 2>err &&
test_i18ngrep "mutually exclusive" err
test_i18ngrep "cannot be used together" err
'
test_expect_success 'implicit bare & --separate-git-dir incompatible' '

View File

@ -25,7 +25,7 @@ test_expect_success 'checkout --no-overlay removing last file from directory' '
test_expect_success 'checkout -p --overlay is disallowed' '
test_must_fail git checkout -p --overlay HEAD 2>actual &&
test_i18ngrep "fatal: -p and --overlay are mutually exclusive" actual
test_i18ngrep "fatal: options .-p. and .--overlay. cannot be used together" actual
'
test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '