]> git.ipfire.org Git - thirdparty/git.git/commitdiff
i18n: factorize "--foo requires --bar" and the like
authorJean-Noël Avila <jn.avila@free.fr>
Wed, 5 Jan 2022 20:02:19 +0000 (20:02 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 5 Jan 2022 21:31:00 +0000 (13:31 -0800)
They are all replaced by "the option '%s' requires '%s'", which is a
new string but replaces 17 previous unique strings.

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>
21 files changed:
archive.c
builtin/add.c
builtin/checkout.c
builtin/commit.c
builtin/fast-export.c
builtin/index-pack.c
builtin/log.c
builtin/reset.c
builtin/rm.c
builtin/stash.c
builtin/worktree.c
fetch-pack.c
http-fetch.c
revision.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/t7107-reset-pathspec-file.sh
t/t7526-commit-pathspec-file.sh

index 78d354670083d6e458ae9a6b64b3517661227468..d571249cf393396ca9815cf805f39b3d3d82c2d6 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -577,7 +577,7 @@ static int parse_archive_args(int argc, const char **argv,
        if (remote)
                die(_("Unexpected option --remote"));
        if (exec)
-               die(_("Option --exec can only be used together with --remote"));
+               die(_("the option '%s' requires '%s'"), "--exec", "--remote");
        if (output)
                die(_("Unexpected option --output"));
        if (is_remote && args->extra_files.nr)
index 4b2754345add857ea904998f94e781fedc8b094e..067ec53d69f450de98f8b017dec81956a3f7cc9b 100644 (file)
@@ -541,7 +541,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                die(_("options '%s' and '%s' cannot be used together"), "-A", "-u");
 
        if (!show_only && ignore_missing)
-               die(_("Option --ignore-missing can only be used together with --dry-run"));
+               die(_("the option '%s' requires '%s'"), "--ignore-missing", "--dry-run");
 
        if (chmod_arg && ((chmod_arg[0] != '-' && chmod_arg[0] != '+') ||
                          chmod_arg[1] != 'x' || chmod_arg[2]))
@@ -573,7 +573,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
                                    PATHSPEC_SYMLINK_LEADING_PATH,
                                    prefix, pathspec_from_file, pathspec_file_nul);
        } else if (pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        if (require_pathspec && pathspec.nr == 0) {
index 73f5a6fbfa1c04099fd5f0ed4151da6d809ea47e..af5fa8228eb8b5a0f608abfb8ea5bd3f721f56e7 100644 (file)
@@ -1758,7 +1758,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                                    0,
                                    prefix, opts->pathspec_from_file, opts->pathspec_file_nul);
        } else if (opts->pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        opts->pathspec.recursive = 1;
index 067c795ca4b7db8c8d1e4854e6e6165dceafc60e..49e7477747f4be84dd46b175d7d9115eb092a3ef 100644 (file)
@@ -367,7 +367,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
                                    PATHSPEC_PREFER_FULL,
                                    prefix, pathspec_from_file, pathspec_file_nul);
        } else if (pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        if (!pathspec.nr && (also || (only && !allow_empty &&
index 1f8fe7b3ac1b07bf5ffa83a1e06ebfa936e3f9a2..f4d9aa1e8d1e4cfb8db07626a17471df7b20d0d5 100644 (file)
@@ -1254,7 +1254,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
                usage_with_options (fast_export_usage, options);
 
        if (anonymized_seeds.cmpfn && !anonymize)
-               die(_("--anonymize-map without --anonymize does not make sense"));
+               die(_("the option '%s' requires '%s'"), "--anonymize-map", "--anonymize");
 
        if (refspecs_list.nr) {
                int i;
index 30ce2ac746de66070e4f0ecd50591f77b016621d..3c2e6aee3cc67be5df9bc1b4b62f5cd8a5c26b86 100644 (file)
@@ -1845,7 +1845,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
        if (!pack_name && !from_stdin)
                usage(index_pack_usage);
        if (fix_thin_pack && !from_stdin)
-               die(_("--fix-thin cannot be used without --stdin"));
+               die(_("the option '%s' requires '%s'"), "--fix-thin", "--stdin");
        if (from_stdin && !startup_info->have_repository)
                die(_("--stdin requires a git repository"));
        if (from_stdin && hash_algo)
index 74b41db1ceef85569668931044ca1d9cd60fdeaa..ded042f3e01e24d3dfc764a478a7a96c4651a499 100644 (file)
@@ -2112,7 +2112,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
        if (creation_factor < 0)
                creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT;
        else if (!rdiff_prev)
-               die(_("--creation-factor requires --range-diff"));
+               die(_("the option '%s' requires '%s'"), "--creation-factor", "--range-diff");
 
        if (rdiff_prev) {
                if (!cover_letter && total != 1)
index 248998fd6faa926e513f7706bd464730c5dc62d6..4779e70dfbe604f589f51329adbc1ed39684461d 100644 (file)
@@ -432,7 +432,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                                    PATHSPEC_PREFER_FULL,
                                    prefix, pathspec_from_file, pathspec_file_nul);
        } else if (pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
@@ -490,7 +490,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
                    _(reset_type_names[reset_type]));
 
        if (intent_to_add && reset_type != MIXED)
-               die(_("-N can only be used with --mixed"));
+               die(_("the option '%s' requires '%s'"), "-N", "--mixed");
 
        prepare_repo_settings(the_repository);
        the_repository->settings.command_requires_full_index = 0;
index 3d0967cdc11308b966e6225d6b95dd7ae90ab364..cfdf24cf49a0f41b8cde7bb70b69e3f90e2c60f4 100644 (file)
@@ -278,7 +278,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
                                    PATHSPEC_PREFER_CWD,
                                    prefix, pathspec_from_file, pathspec_file_nul);
        } else if (pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        if (!pathspec.nr)
index 4d793bd0b521eab179fbc995ad3764a268ae73bc..3e3743fd5a383af4b53283febd0fa53facd8e7ae 100644 (file)
@@ -1712,7 +1712,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
                                    PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN,
                                    prefix, pathspec_from_file, pathspec_file_nul);
        } else if (pathspec_file_nul) {
-               die(_("--pathspec-file-nul requires --pathspec-from-file"));
+               die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
        }
 
        return do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,
index ec1c59ba53cd62cafee3688ff2fa6f14bcc78f0f..2838254f7f2e10f780ea8608d591c6fd8e8f5521 100644 (file)
@@ -505,7 +505,7 @@ static int add(int ac, const char **av, const char *prefix)
        if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
                die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
        if (lock_reason && !keep_locked)
-               die(_("--reason requires --lock"));
+               die(_("the option '%s' requires '%s'"), "--reason", "--lock");
        if (lock_reason)
                opts.keep_locked = lock_reason;
        else if (keep_locked)
index 34987a2c30d5a617bc44a9a632151abc354b034c..dd6ec449f2dbc87dfb0e9922d1e1c772ccae419e 100644 (file)
@@ -297,7 +297,7 @@ static int find_common(struct fetch_negotiator *negotiator,
        struct packet_reader reader;
 
        if (args->stateless_rpc && multi_ack == 1)
-               die(_("--stateless-rpc requires multi_ack_detailed"));
+               die(_("the option '%s' requires '%s'"), "--stateless-rpc", "multi_ack_detailed");
 
        packet_reader_init(&reader, fd[0], NULL, 0,
                           PACKET_READ_CHOMP_NEWLINE |
index c7c7d391ac5b8172496fec464539c9d9ad237b91..58b394cd47f3f068177c622e927532497126e14c 100644 (file)
@@ -141,7 +141,7 @@ int cmd_main(int argc, const char **argv)
 
        if (packfile) {
                if (!index_pack_args.nr)
-                       die(_("--packfile requires --index-pack-args"));
+                       die(_("the option '%s' requires '%s'"), "--packfile", "--index-pack-args");
 
                fetch_single_packfile(&packfile_hash, argv[arg],
                                      index_pack_args.v);
@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)
        }
 
        if (index_pack_args.nr)
-               die(_("--index-pack-args can only be used with --packfile"));
+               die(_("the option '%s' requires '%s'"), "--index-pack-args", "--packfile");
 
        if (commits_on_stdin) {
                commits = walker_targets_stdin(&commit_id, &write_ref);
index d28b63a32531b44673d965d8171952864a28eb13..13ccc6829f16fe019728b60261fd0ab654d3fdbc 100644 (file)
@@ -2884,7 +2884,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        if (revs->no_walk && revs->graph)
                die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
        if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
-               die("cannot use --grep-reflog without --walk-reflogs");
+               die(_("the option '%s' requires '%s'"), "--grep-reflog", "--walk-reflogs");
 
        if (revs->line_level_traverse &&
            (revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT)))
index fbe26de2f90c1cd278b8471fe8a59f361606df49..9e6b17e2d231bb81ee71b7c7d48a50ce7e1cc7bb 100755 (executable)
@@ -158,7 +158,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git checkout --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
 '
 
 test_done
index ad1fc0ed071dfa90ef9c9369c88e74b4bf87b25c..af67ca7d52bb9c1e986c68f34dc004392602575f 100755 (executable)
@@ -158,7 +158,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err &&
        test_i18ngrep -e "you must specify path(s) to restore" err
index b2a8db69afc69f20c33309e808711c0502467770..bbed67f8ef526565182048f773744f876236b6e4 100755 (executable)
@@ -70,7 +70,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git rm --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        >empty_list &&
        test_must_fail git rm --pathspec-from-file=empty_list 2>err &&
index 7e17ae80229c26d39d3602aa4b73845af36d0d18..47ad96bf6619c5855685a491026dbcacb7ef1a16 100755 (executable)
@@ -150,7 +150,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git add --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        # This case succeeds, but still prints to stderr
        git add --pathspec-from-file=empty_list 2>err &&
index aae2b25f76667bff7af84c53f54418b9931a8ff4..fde4625cfcb7f2c0ed5699f1dee2349fd44e4ea7 100755 (executable)
@@ -94,7 +94,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git stash push --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
 '
 
 test_done
index b211fbc0a520116d81df29c31d729012912dc5a3..f753e3229e2da8855d51d4a0f2d203a6e895a175 100755 (executable)
@@ -166,7 +166,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git reset --pathspec-file-nul 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git reset --soft --pathspec-from-file=list 2>err &&
        test_i18ngrep -e "fatal: Cannot do soft reset with paths" err &&
index 574cf30285cacde0d89de6b2b85dc63da42d6589..ea69e3a6ad1505f3c82b30fe9606497ea1768f38 100755 (executable)
@@ -153,7 +153,7 @@ test_expect_success 'error conditions' '
        test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
 
        test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
-       test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
+       test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
 
        test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err &&
        test_i18ngrep -e "No paths with --include/--only does not make sense." err &&