]> git.ipfire.org Git - thirdparty/git.git/commitdiff
i18n: factorize even more 'incompatible options' messages
authorRené Scharfe <l.s.r@web.de>
Sun, 26 Nov 2023 11:57:43 +0000 (12:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Nov 2023 01:01:45 +0000 (10:01 +0900)
Continue the work of 12909b6b8a (i18n: turn "options are incompatible"
into "cannot be used together", 2022-01-05) and a699367bb8 (i18n:
factorize more 'incompatible options' messages, 2022-01-31) to use the
same parameterized error message for reporting incompatible command line
options.  This reduces the number of strings to translate and makes the
UI slightly more consistent.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/clone.c
builtin/merge-tree.c
parse-options.c
revision.c
t/t0040-parse-options.sh
t/t1006-cat-file.sh
t/t4301-merge-tree-write-tree.sh
t/t5606-clone-options.sh

index c6357af949895a688639c83984598931906b2690..45a5070268a0336d82840e2087069cc844ad3815 100644 (file)
@@ -965,7 +965,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        }
 
        if (bundle_uri && deepen)
-               die(_("--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-exclude"));
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--bundle-uri",
+                   "--depth/--shallow-since/--shallow-exclude");
 
        repo_name = argv[0];
 
index a35e0452d6672594da29623e8934256f37784549..a4aa6013c512f5f71e2be39d4a01afce5716b47c 100644 (file)
@@ -577,7 +577,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
                if (o.mode == MODE_TRIVIAL)
                        die(_("--trivial-merge is incompatible with all other options"));
                if (merge_base)
-                       die(_("--merge-base is incompatible with --stdin"));
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--merge-base", "--stdin");
                line_termination = '\0';
                while (strbuf_getline_lf(&buf, stdin) != EOF) {
                        struct strbuf **split;
index e0c94b0546b5487c5b324c4c2b76d668289e8b10..c3955847f4c9dfb29da07784bc55836da047d5b2 100644 (file)
@@ -279,7 +279,8 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
 
        opt_name = optnamearg(opt, arg, flags);
        other_opt_name = optnamearg(elem->opt, elem->arg, elem->flags);
-       error(_("%s is incompatible with %s"), opt_name, other_opt_name);
+       error(_("options '%s' and '%s' cannot be used together"),
+             opt_name, other_opt_name);
        free(opt_name);
        free(other_opt_name);
        return -1;
index 00d5c29bfce18a1d4a5f5d701a593596ccd65783..b2861474b145e2e7e85de4c06833b7103280d08d 100644 (file)
@@ -2384,8 +2384,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->left_right = 1;
        } else if (!strcmp(arg, "--left-only")) {
                if (revs->right_only)
-                       die("--left-only is incompatible with --right-only"
-                           " or --cherry");
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--left-only", "--right-only/--cherry");
                revs->left_only = 1;
        } else if (!strcmp(arg, "--right-only")) {
                if (revs->left_only)
index 8fdef88b65e77bd03b9db8fc287914022ab10848..ec974867e4337ca503cb817fd79926193c518710 100755 (executable)
@@ -376,7 +376,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (1)' '
        test_must_be_empty output &&
        test_grep "mode1" output.err &&
        test_grep "mode2" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
@@ -384,7 +384,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "set23" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
@@ -392,7 +392,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "set23" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
@@ -401,7 +401,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "mode34.3" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
index d73a0be1b9d1bfa3e0f1fd96e69c0e78ad2dec06..271c5e4fd38cb367b302de00ae49cfdf454d2ae6 100755 (executable)
@@ -6,7 +6,7 @@ test_description='git cat-file'
 
 test_cmdmode_usage () {
        test_expect_code 129 "$@" 2>err &&
-       grep "^error:.*is incompatible with" err
+       grep "^error: .* cannot be used together" err
 }
 
 for switches in \
index b2c8a43fce311570e358d77a3b062228adcbbf68..12ac43687366d72f2fa2870c72a9d5563a05fc66 100755 (executable)
@@ -887,7 +887,7 @@ test_expect_success '--stdin with both a successful and a conflicted merge' '
 test_expect_success '--merge-base is incompatible with --stdin' '
        test_must_fail git merge-tree --merge-base=side1 --stdin 2>expect &&
 
-       grep "^fatal: --merge-base is incompatible with --stdin" expect
+       grep "^fatal: .*merge-base.*stdin.* cannot be used together" expect
 '
 
 # specify merge-base as parent of branch2
index fc4bbd9daf4fd3bf1777699f05af9ca39ac5a954..a400bcca622f464f13fe4f0a57c4d44ec8dd827b 100755 (executable)
@@ -64,7 +64,7 @@ test_expect_success 'disallows --bundle-uri with shallow options' '
        for option in --depth=1 --shallow-since=01-01-2000 --shallow-exclude=HEAD
        do
                test_must_fail git clone --bundle-uri=bundle $option from to 2>err &&
-               grep "bundle-uri is incompatible" err || return 1
+               grep "bundle-uri.* cannot be used together" err || return 1
        done
 '