]> git.ipfire.org Git - thirdparty/git.git/commitdiff
i18n: turn even more messages into "cannot be used together" ones
authorJean-Noël Avila <jn.avila@free.fr>
Wed, 5 Jan 2022 20:02:24 +0000 (20:02 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Jan 2022 21:31:00 +0000 (13:31 -0800)
Even if some of these messages are not subject to gettext i18n, this
helps bring a single style of message for a given error type.

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>
23 files changed:
builtin/add.c
builtin/am.c
builtin/cat-file.c
builtin/checkout.c
builtin/clone.c
builtin/commit.c
builtin/describe.c
builtin/rebase.c
builtin/reset.c
builtin/rev-list.c
builtin/rm.c
builtin/stash.c
diff.c
t/t2026-checkout-pathspec-file.sh
t/t2072-restore-pathspec-file.sh
t/t3601-rm-pathspec-file.sh
t/t3704-add-pathspec-file.sh
t/t3909-stash-pathspec-file.sh
t/t4209-log-pickaxe.sh
t/t5606-clone-options.sh
t/t7107-reset-pathspec-file.sh
t/t7500-commit-template-squash-signoff.sh
t/t7526-commit-pathspec-file.sh

index 067ec53d69f450de98f8b017dec81956a3f7cc9b..84dff3e796918ada3777fd7c01114ff5c9521fec 100644 (file)
@@ -566,7 +566,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 
        if (pathspec_from_file) {
                if (pathspec.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                parse_pathspec_file(&pathspec, PATHSPEC_ATTR,
                                    PATHSPEC_PREFER_FULL |
index 8677ea2348ab5b8017fc82cd1f8b79e4a7d20122..68a190dd9f5c78446b29adf8c23059dec5914402 100644 (file)
@@ -2230,9 +2230,9 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
        }
 
        if (resume->mode == RESUME_SHOW_PATCH && new_value != resume->sub_mode)
-               return error(_("--show-current-patch=%s is incompatible with "
-                              "--show-current-patch=%s"),
-                            arg, valid_modes[resume->sub_mode]);
+               return error(_("options '%s=%s' and '%s=%s' "
+                                          "cannot be used together"),
+                                        "--show-current-patch", "--show-current-patch", arg, valid_modes[resume->sub_mode]);
 
        resume->mode = RESUME_SHOW_PATCH;
        resume->sub_mode = new_value;
index 86fc03242b87c36784bb31a88eb21f6c727da893..d94050e6c188ff4594a065da87695c67c560ac94 100644 (file)
@@ -729,7 +729,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
        }
 
        if (force_path && batch.enabled) {
-               error("--path=<path> incompatible with --batch");
+               error("options '--path=<path>' and '--batch' cannot be used together");
                usage_with_options(cat_file_usage, options);
        }
 
index af5fa8228eb8b5a0f608abfb8ea5bd3f721f56e7..eb3a69c21201ed7209606e39273aba5f55f6d096 100644 (file)
@@ -1635,8 +1635,8 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
        }
 
        if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1)
-               die(_("-%c, -%c and --orphan are mutually exclusive"),
-                               cb_option, toupper(cb_option));
+               die(_("options '-%c', '-%c', and '%s' cannot be used together"),
+                       cb_option, toupper(cb_option), "--orphan");
 
        if (opts->overlay_mode == 1 && opts->patch_mode)
                die(_("options '%s' and '%s' cannot be used together"), "-p", "--overlay");
@@ -1746,7 +1746,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
 
        if (opts->pathspec_from_file) {
                if (opts->pathspec.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                if (opts->force_detach)
                        die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--detach");
index 13bdbe14b2f2ab3e042a285d05f3c561681e0c76..8b79666e3a7401ed45e0f4e97bd764a988426b2f 100644 (file)
@@ -900,8 +900,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
        if (option_bare) {
                if (option_origin)
-                       die(_("--bare and --origin %s options are incompatible."),
-                           option_origin);
+                       die(_("options '%s' and '%s %s' cannot be used together"),
+                           "--bare", "--origin", option_origin);
                if (real_git_dir)
                        die(_("options '%s' and '%s' cannot be used together"), "--bare", "--separate-git-dir");
                option_no_checkout = 1;
index 49e7477747f4be84dd46b175d7d9115eb092a3ef..b9ed0374e301ae958906435fa6592e9d3bbe52fa 100644 (file)
@@ -361,7 +361,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
                        die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "-a");
 
                if (pathspec.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                parse_pathspec_file(&pathspec, 0,
                                    PATHSPEC_PREFER_FULL,
@@ -799,7 +799,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 
                if (!strcmp(fixup_prefix, "amend")) {
                        if (have_option_m)
-                               die(_("cannot combine -m with --fixup:%s"), fixup_message);
+                               die(_("options '%s' and '%s:%s' cannot be used together"), "-m", "--fixup", fixup_message);
                        prepare_amend_commit(commit, &sb, &ctx);
                }
        } else if (!stat(git_path_merge_msg(the_repository), &statbuf)) {
@@ -1229,9 +1229,10 @@ static void check_fixup_reword_options(int argc, const char *argv[]) {
                        die(_("You are in the middle of a cherry-pick -- cannot reword."));
        }
        if (argc)
-               die(_("cannot combine reword option of --fixup with path '%s'"), *argv);
+               die(_("reword option of '%s' and path '%s' cannot be used together"), "--fixup", *argv);
        if (patch_interactive || interactive || all || also || only)
-               die(_("reword option of --fixup is mutually exclusive with --patch/--interactive/--all/--include/--only"));
+               die(_("reword option of '%s' and '%s' cannot be used together"),
+                       "--fixup", "--patch/--interactive/--all/--include/--only");
 }
 
 static int parse_and_validate_options(int argc, const char *argv[],
index fd5ba1fc6046f8753271f606cc0a06162f48b576..42159cd26bd80797ab082d4d2509cf17ec8fc113 100644 (file)
@@ -670,9 +670,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
                }
                describe("HEAD", 1);
        } else if (dirty) {
-               die(_("--dirty is incompatible with commit-ishes"));
+               die(_("option '%s' and commit-ishes cannot be used together"), "--dirty");
        } else if (broken) {
-               die(_("--broken is incompatible with commit-ishes"));
+               die(_("option '%s' and commit-ishes cannot be used together"), "--broken");
        } else {
                while (argc-- > 0)
                        describe(*argv++, argc == 0);
index 16e6053b14a1be5a6270c30c9856b42cfe32359d..36490d06c8ac6ad4c10596b7e2a4556ec7aaa8c8 100644 (file)
@@ -1460,8 +1460,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
                if (i >= 0) {
                        if (is_merge(&options))
-                               die(_("cannot combine apply options with "
-                                     "merge options"));
+                               die(_("apply options and merge options "
+                                         "cannot be used together"));
                        else
                                options.type = REBASE_APPLY;
                }
index 4779e70dfbe604f589f51329adbc1ed39684461d..b97745ee94e5a30a25a477f432a275d6ae953ee2 100644 (file)
@@ -426,7 +426,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                        die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--patch");
 
                if (pathspec.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                parse_pathspec_file(&pathspec, 0,
                                    PATHSPEC_PREFER_FULL,
index c1a3b0b35916e307366130d4ad7bcf31ccc2b27e..777558e9b067ebbf7e91ba4e65570a86bd25a105 100644 (file)
@@ -676,7 +676,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
        if (revs.count &&
            (revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
            (revs.left_right || revs.cherry_mark))
-               die(_("marked counting is incompatible with --objects"));
+               die(_("marked counting and '%s' cannot be used together"), "--objects");
 
        save_commit_buffer = (revs.verbose_header ||
                              revs.grep_filter.pattern_list ||
index cfdf24cf49a0f41b8cde7bb70b69e3f90e2c60f4..127a6f0220c7c6e8884a1daad6de44f7a981707a 100644 (file)
@@ -272,7 +272,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 
        if (pathspec_from_file) {
                if (pathspec.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                parse_pathspec_file(&pathspec, 0,
                                    PATHSPEC_PREFER_CWD,
index 3e3743fd5a383af4b53283febd0fa53facd8e7ae..7b1876b3e31531782a73b9ad5a266d1665df74de 100644 (file)
@@ -1706,7 +1706,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
                        die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--staged");
 
                if (ps.nr)
-                       die(_("--pathspec-from-file is incompatible with pathspec arguments"));
+                       die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
 
                parse_pathspec_file(&ps, 0,
                                    PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN,
diff --git a/diff.c b/diff.c
index 02ce779e43ad50078b2cad1415cb1f2984e61db7..da5fc81a543ef5c82dd1a7d90bbea7d797a76a2b 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -4639,16 +4639,20 @@ void diff_setup_done(struct diff_options *options)
                options->set_default(options);
 
        if (HAS_MULTI_BITS(options->output_format & check_mask))
-               die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
+               die(_("options '%s', '%s', '%s', and '%s' cannot be used together"),
+                       "--name-only", "--name-status", "--check", "-s");
 
        if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
-               die(_("options '%s', '%s', and '%s' cannot be used together"), "-G", "-S", "--find-object");
+               die(_("options '%s', '%s', and '%s' cannot be used together"),
+                       "-G", "-S", "--find-object");
 
        if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_G_REGEX_MASK))
-               die(_("-G and --pickaxe-regex are mutually exclusive, use --pickaxe-regex with -S"));
+               die(_("options '%s' and '%s' cannot be used together, use '%s' with '%s'"),
+                       "-G", "--pickaxe-regex", "--pickaxe-regex", "-S");
 
        if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_ALL_OBJFIND_MASK))
-               die(_("--pickaxe-all and --find-object are mutually exclusive, use --pickaxe-all with -G and -S"));
+               die(_("options '%s' and '%s' cannot be used together, use '%s' with '%s' and '%s'"),
+                       "--pickaxe-all", "--find-object", "--pickaxe-all", "-G", "-S");
 
        /*
         * Most of the time we can say "there are changes"
index 9e6b17e2d231bb81ee71b7c7d48a50ce7e1cc7bb..9c651aefbca44283f3ac5f018557d97fb615106c 100755 (executable)
@@ -155,7 +155,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git checkout --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git checkout --pathspec-file-nul 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
index af67ca7d52bb9c1e986c68f34dc004392602575f..c22669b39f938d901555e2c9a43d8d1f07de6da8 100755 (executable)
@@ -155,7 +155,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git restore --pathspec-from-file=list --source=HEAD^1 -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
index bbed67f8ef526565182048f773744f876236b6e4..a2a0c820fe38a976b963570453df17a089599f9d 100755 (executable)
@@ -67,7 +67,7 @@ test_expect_success 'error conditions' '
        echo fileA.t >list &&
 
        test_must_fail git rm --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git rm --pathspec-file-nul 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
index 47ad96bf6619c5855685a491026dbcacb7ef1a16..4e6b5177c9329b11ee9046d75e6cf5b0dbf358df 100755 (executable)
@@ -147,7 +147,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .--edit. cannot be used together" err &&
 
        test_must_fail git add --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git add --pathspec-file-nul 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
index fde4625cfcb7f2c0ed5699f1dee2349fd44e4ea7..dead9f18d937599427afe2c29fc177ed00f187ec 100755 (executable)
@@ -91,7 +91,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git stash push --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git stash push --pathspec-file-nul 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
index 4f820f8597d63abef1e9b4621f80fc753ecadf68..7f6bb27f141fe786811302f023366e6d15a5aa0e 100755 (executable)
@@ -72,12 +72,12 @@ test_expect_success 'usage' '
        grep "cannot be used together" err &&
 
        test_expect_code 128 git log --pickaxe-all --find-object=HEAD 2>err &&
-       grep "mutually exclusive" err
+       grep "cannot be used together" err
 '
 
 test_expect_success 'usage: --pickaxe-regex' '
        test_expect_code 128 git log -Gregex --pickaxe-regex 2>err &&
-       grep "mutually exclusive" err
+       grep "cannot be used together" err
 '
 
 test_expect_success 'usage: --no-pickaxe-regex' '
index 3af3577af0be498467c82e88868dfaf7ee883d78..8f676d6b0c0e2f6f72b2c0285afaca5b16be3017 100755 (executable)
@@ -46,7 +46,7 @@ test_expect_success 'disallows --bare with --origin' '
 
        test_must_fail git clone -o foo --bare parent clone-bare-o 2>err &&
        test_debug "cat err" &&
-       test_i18ngrep -e "--bare and --origin foo options are incompatible" err
+       test_i18ngrep -e "options .--bare. and .--origin foo. cannot be used together" err
 
 '
 
index f753e3229e2da8855d51d4a0f2d203a6e895a175..523efbecde1dff517ffebf3c04cfcf74ea280f15 100755 (executable)
@@ -163,7 +163,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .--patch. cannot be used together" err &&
 
        test_must_fail git reset --pathspec-from-file=list -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git reset --pathspec-file-nul 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
index 8dd0f988129d5f35c3b0aa93ba2f441c20d5afe9..91964653a0b6937cf41c3ac2b687523f482abdb2 100755 (executable)
@@ -359,14 +359,14 @@ test_expect_success '--fixup=reword: ignores staged changes' '
 
 test_expect_success '--fixup=reword: error out with -m option' '
        commit_for_rebase_autosquash_setup &&
-       echo "fatal: cannot combine -m with --fixup:reword" >expect &&
+       echo "fatal: options '\''-m'\'' and '\''--fixup:reword'\'' cannot be used together" >expect &&
        test_must_fail git commit --fixup=reword:HEAD~ -m "reword commit message" 2>actual &&
        test_cmp expect actual
 '
 
 test_expect_success '--fixup=amend: error out with -m option' '
        commit_for_rebase_autosquash_setup &&
-       echo "fatal: cannot combine -m with --fixup:amend" >expect &&
+       echo "fatal: options '\''-m'\'' and '\''--fixup:amend'\'' cannot be used together" >expect &&
        test_must_fail git commit --fixup=amend:HEAD~ -m "amend commit message" 2>actual &&
        test_cmp expect actual
 '
@@ -421,8 +421,9 @@ test_expect_success 'amend! commit allows empty commit msg body with --allow-emp
 
 test_fixup_reword_opt () {
        test_expect_success "--fixup=reword: incompatible with $1" "
-               echo 'fatal: reword option of --fixup is mutually exclusive with'\
-                       '--patch/--interactive/--all/--include/--only' >expect &&
+               echo 'fatal: reword option of '\''--fixup'\'' and' \
+                       ''\''--patch/--interactive/--all/--include/--only'\' \
+                       'cannot be used together' >expect &&
                test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual &&
                test_cmp expect actual
        "
@@ -435,7 +436,7 @@ done
 
 test_expect_success '--fixup=reword: give error with pathsec' '
        commit_for_rebase_autosquash_setup &&
-       echo "fatal: cannot combine reword option of --fixup with path '\''foo'\''" >expect &&
+       echo "fatal: reword option of '\''--fixup'\'' and path '\''foo'\'' cannot be used together" >expect &&
        test_must_fail git commit --fixup=reword:HEAD~ -- foo 2>actual &&
        test_cmp expect actual
 '
index ea69e3a6ad1505f3c82b30fe9606497ea1768f38..ad011bb9f158034171c04e76722b183eece45576 100755 (executable)
@@ -150,7 +150,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "options .--pathspec-from-file. and .-a. cannot be used together" err &&
 
        test_must_fail git commit --pathspec-from-file=list -m "Commit" -- fileA.t 2>err &&
-       test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
+       test_i18ngrep -e ".--pathspec-from-file. and pathspec arguments cannot be used together" err &&
 
        test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
        test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&