Skip to content

Commit 43ea635

Browse files
jnavilagitster
authored andcommitted
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 <[email protected]> Reviewed-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2ae0a9c commit 43ea635

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1639,7 +1639,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
16391639
cb_option, toupper(cb_option));
16401640

16411641
if (opts->overlay_mode == 1 && opts->patch_mode)
1642-
die(_("-p and --overlay are mutually exclusive"));
1642+
die(_("options '%s' and '%s' cannot be used together"), "-p", "--overlay");
16431643

16441644
if (opts->checkout_index >= 0 || opts->checkout_worktree >= 0) {
16451645
if (opts->checkout_index < 0)

builtin/diff-tree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
152152
}
153153

154154
if (read_stdin && merge_base)
155-
die(_("--stdin and --merge-base are mutually exclusive"));
155+
die(_("options '%s' and '%s' cannot be used together"), "--stdin", "--merge-base");
156156
if (merge_base && opt->pending.nr != 2)
157157
die(_("--merge-base only works with two commits"));
158158

builtin/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,12 +2028,12 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
20282028
if (deepen_relative < 0)
20292029
die(_("negative depth in --deepen is not supported"));
20302030
if (depth)
2031-
die(_("--deepen and --depth are mutually exclusive"));
2031+
die(_("options '%s' and '%s' cannot be used together"), "--deepen", "--depth");
20322032
depth = xstrfmt("%d", deepen_relative);
20332033
}
20342034
if (unshallow) {
20352035
if (depth)
2036-
die(_("--depth and --unshallow cannot be used together"));
2036+
die(_("options '%s' and '%s' cannot be used together"), "--depth", "--unshallow");
20372037
else if (!is_repository_shallow(the_repository))
20382038
die(_("--unshallow on a complete repository does not make sense"));
20392039
else

builtin/init-db.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
557557
argc = parse_options(argc, argv, prefix, init_db_options, init_db_usage, 0);
558558

559559
if (real_git_dir && is_bare_repository_cfg == 1)
560-
die(_("--separate-git-dir and --bare are mutually exclusive"));
560+
die(_("options '%s' and '%s' cannot be used together"), "--separate-git-dir", "--bare");
561561

562562
if (real_git_dir && !is_absolute_path(real_git_dir))
563563
real_git_dir = real_pathdup(real_git_dir, 1);

builtin/log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,9 +1943,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
19431943
numbered = 0;
19441944

19451945
if (numbered && keep_subject)
1946-
die(_("-n and -k are mutually exclusive"));
1946+
die(_("options '%s' and '%s' cannot be used together"), "-n", "-k");
19471947
if (keep_subject && subject_prefix)
1948-
die(_("--subject-prefix/--rfc and -k are mutually exclusive"));
1948+
die(_("options '%s' and '%s' cannot be used together"), "--subject-prefix/--rfc", "-k");
19491949
rev.preserve_subject = keep_subject;
19501950

19511951
argc = setup_revisions(argc, argv, &rev, &s_r_opt);

builtin/submodule--helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static int module_summary(int argc, const char **argv, const char *prefix)
13131313

13141314
if (files) {
13151315
if (cached)
1316-
die(_("--cached and --files are mutually exclusive"));
1316+
die(_("options '%s' and '%s' cannot be used together"), "--cached", "--files");
13171317
diff_cmd = DIFF_FILES;
13181318
}
13191319

@@ -2972,7 +2972,7 @@ static int module_set_branch(int argc, const char **argv, const char *prefix)
29722972
die(_("--branch or --default required"));
29732973

29742974
if (opt_branch && opt_default)
2975-
die(_("--branch and --default are mutually exclusive"));
2975+
die(_("options '%s' and '%s' cannot be used together"), "--branch", "--default");
29762976

29772977
if (argc != 1 || !(path = argv[0]))
29782978
usage_with_options(usage, options);

builtin/worktree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ static int list(int ac, const char **av, const char *prefix)
699699
if (ac)
700700
usage_with_options(worktree_usage, options);
701701
else if (verbose && porcelain)
702-
die(_("--verbose and --porcelain are mutually exclusive"));
702+
die(_("options '%s' and '%s' cannot be used together"), "--verbose", "--porcelain");
703703
else {
704704
struct worktree **worktrees = get_worktrees();
705705
int path_maxlen = 0, abbrev = DEFAULT_ABBREV, i;

range-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ int show_range_diff(const char *range1, const char *range2,
556556
struct string_list branch2 = STRING_LIST_INIT_DUP;
557557

558558
if (range_diff_opts->left_only && range_diff_opts->right_only)
559-
res = error(_("--left-only and --right-only are mutually exclusive"));
559+
res = error(_("options '%s' and '%s' cannot be used together"), "--left-only", "--right-only");
560560

561561
if (!res && read_patches(range1, &branch1, range_diff_opts->other_arg))
562562
res = error(_("could not parse log for '%s'"), range1);

t/t0001-init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ test_expect_success 'init with separate gitdir' '
331331

332332
test_expect_success 'explicit bare & --separate-git-dir incompatible' '
333333
test_must_fail git init --bare --separate-git-dir goop.git bare.git 2>err &&
334-
test_i18ngrep "mutually exclusive" err
334+
test_i18ngrep "cannot be used together" err
335335
'
336336

337337
test_expect_success 'implicit bare & --separate-git-dir incompatible' '

t/t2025-checkout-no-overlay.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test_expect_success 'checkout --no-overlay removing last file from directory' '
2525

2626
test_expect_success 'checkout -p --overlay is disallowed' '
2727
test_must_fail git checkout -p --overlay HEAD 2>actual &&
28-
test_i18ngrep "fatal: -p and --overlay are mutually exclusive" actual
28+
test_i18ngrep "fatal: options .-p. and .--overlay. cannot be used together" actual
2929
'
3030

3131
test_expect_success '--no-overlay --theirs with D/F conflict deletes file' '

0 commit comments

Comments
 (0)