i18n: factorize "--foo requires --bar" and the like
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>
Jean-Noël Avila committed
Jan 5, 2022 at 20:02 UTC
6fa00ee843cb6c8e720180b4642590f5bcc9c8cf
21 files changed
+24
-24
archive.c
+1
-1
@@ -577,7 +577,7 @@ static int parse_archive_args(int argc, const char **argv,
577
if (remote)
578
die(_("Unexpected option --remote"));
579
if (exec)
580
- die(_("Option --exec can only be used together with --remote"));
580
+ die(_("the option '%s' requires '%s'"), "--exec", "--remote");
581
if (output)
582
die(_("Unexpected option --output"));
583
if (is_remote && args->extra_files.nr)
builtin/add.c
+2
-2
@@ -541,7 +541,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
541
die(_("options '%s' and '%s' cannot be used together"), "-A", "-u");
542
543
if (!show_only && ignore_missing)
544
- die(_("Option --ignore-missing can only be used together with --dry-run"));
544
+ die(_("the option '%s' requires '%s'"), "--ignore-missing", "--dry-run");
545
546
if (chmod_arg && ((chmod_arg[0] != '-' && chmod_arg[0] != '+') ||
547
chmod_arg[1] != 'x' || chmod_arg[2]))
@@ -573,7 +573,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
573
PATHSPEC_SYMLINK_LEADING_PATH,
574
prefix, pathspec_from_file, pathspec_file_nul);
575
} else if (pathspec_file_nul) {
576
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
576
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
577
}
578
579
if (require_pathspec && pathspec.nr == 0) {
builtin/checkout.c
+1
-1
@@ -1758,7 +1758,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
1758
0,
1759
prefix, opts->pathspec_from_file, opts->pathspec_file_nul);
1760
} else if (opts->pathspec_file_nul) {
1761
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
1761
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
1762
}
1763
1764
opts->pathspec.recursive = 1;
builtin/commit.c
+1
-1
@@ -367,7 +367,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
367
PATHSPEC_PREFER_FULL,
368
prefix, pathspec_from_file, pathspec_file_nul);
369
} else if (pathspec_file_nul) {
370
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
370
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
371
}
372
373
if (!pathspec.nr && (also || (only && !allow_empty &&
builtin/fast-export.c
+1
-1
@@ -1254,7 +1254,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
1254
usage_with_options (fast_export_usage, options);
1255
1256
if (anonymized_seeds.cmpfn && !anonymize)
1257
- die(_("--anonymize-map without --anonymize does not make sense"));
1257
+ die(_("the option '%s' requires '%s'"), "--anonymize-map", "--anonymize");
1258
1259
if (refspecs_list.nr) {
1260
int i;
builtin/index-pack.c
+1
-1
@@ -1845,7 +1845,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
1845
if (!pack_name && !from_stdin)
1846
usage(index_pack_usage);
1847
if (fix_thin_pack && !from_stdin)
1848
- die(_("--fix-thin cannot be used without --stdin"));
1848
+ die(_("the option '%s' requires '%s'"), "--fix-thin", "--stdin");
1849
if (from_stdin && !startup_info->have_repository)
1850
die(_("--stdin requires a git repository"));
1851
if (from_stdin && hash_algo)
builtin/log.c
+1
-1
@@ -2112,7 +2112,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
2112
if (creation_factor < 0)
2113
creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT;
2114
else if (!rdiff_prev)
2115
- die(_("--creation-factor requires --range-diff"));
2115
+ die(_("the option '%s' requires '%s'"), "--creation-factor", "--range-diff");
2116
2117
if (rdiff_prev) {
2118
if (!cover_letter && total != 1)
builtin/reset.c
+2
-2
@@ -432,7 +432,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
432
PATHSPEC_PREFER_FULL,
433
prefix, pathspec_from_file, pathspec_file_nul);
434
} else if (pathspec_file_nul) {
435
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
435
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
436
}
437
438
unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
@@ -490,7 +490,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
490
_(reset_type_names[reset_type]));
491
492
if (intent_to_add && reset_type != MIXED)
493
- die(_("-N can only be used with --mixed"));
493
+ die(_("the option '%s' requires '%s'"), "-N", "--mixed");
494
495
prepare_repo_settings(the_repository);
496
the_repository->settings.command_requires_full_index = 0;
builtin/rm.c
+1
-1
@@ -278,7 +278,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
278
PATHSPEC_PREFER_CWD,
279
prefix, pathspec_from_file, pathspec_file_nul);
280
} else if (pathspec_file_nul) {
281
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
281
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
282
}
283
284
if (!pathspec.nr)
builtin/stash.c
+1
-1
@@ -1712,7 +1712,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
1712
PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN,
1713
prefix, pathspec_from_file, pathspec_file_nul);
1714
} else if (pathspec_file_nul) {
1715
- die(_("--pathspec-file-nul requires --pathspec-from-file"));
1715
+ die(_("the option '%s' requires '%s'"), "--pathspec-file-nul", "--pathspec-from-file");
1716
}
1717
1718
return do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,
builtin/worktree.c
+1
-1
@@ -505,7 +505,7 @@ static int add(int ac, const char **av, const char *prefix)
505
if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
506
die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
507
if (lock_reason && !keep_locked)
508
- die(_("--reason requires --lock"));
508
+ die(_("the option '%s' requires '%s'"), "--reason", "--lock");
509
if (lock_reason)
510
opts.keep_locked = lock_reason;
511
else if (keep_locked)
fetch-pack.c
+1
-1
@@ -297,7 +297,7 @@ static int find_common(struct fetch_negotiator *negotiator,
297
struct packet_reader reader;
298
299
if (args->stateless_rpc && multi_ack == 1)
300
- die(_("--stateless-rpc requires multi_ack_detailed"));
300
+ die(_("the option '%s' requires '%s'"), "--stateless-rpc", "multi_ack_detailed");
301
302
packet_reader_init(&reader, fd[0], NULL, 0,
303
PACKET_READ_CHOMP_NEWLINE |
http-fetch.c
+2
-2
@@ -141,7 +141,7 @@ int cmd_main(int argc, const char **argv)
141
142
if (packfile) {
143
if (!index_pack_args.nr)
144
- die(_("--packfile requires --index-pack-args"));
144
+ die(_("the option '%s' requires '%s'"), "--packfile", "--index-pack-args");
145
146
fetch_single_packfile(&packfile_hash, argv[arg],
147
index_pack_args.v);
@@ -150,7 +150,7 @@ int cmd_main(int argc, const char **argv)
150
}
151
152
if (index_pack_args.nr)
153
- die(_("--index-pack-args can only be used with --packfile"));
153
+ die(_("the option '%s' requires '%s'"), "--index-pack-args", "--packfile");
154
155
if (commits_on_stdin) {
156
commits = walker_targets_stdin(&commit_id, &write_ref);
revision.c
+1
-1
@@ -2884,7 +2884,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
2884
if (revs->no_walk && revs->graph)
2885
die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
2886
if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
2887
- die("cannot use --grep-reflog without --walk-reflogs");
2887
+ die(_("the option '%s' requires '%s'"), "--grep-reflog", "--walk-reflogs");
2888
2889
if (revs->line_level_traverse &&
2890
(revs->diffopt.output_format & ~(DIFF_FORMAT_PATCH | DIFF_FORMAT_NO_OUTPUT)))
t/t2026-checkout-pathspec-file.sh
+1
-1
@@ -158,7 +158,7 @@ test_expect_success 'error conditions' '
158
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
159
160
test_must_fail git checkout --pathspec-file-nul 2>err &&
161
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err
161
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
162
'
163
164
test_done
t/t2072-restore-pathspec-file.sh
+1
-1
@@ -158,7 +158,7 @@ test_expect_success 'error conditions' '
158
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
159
160
test_must_fail git restore --pathspec-file-nul --source=HEAD^1 2>err &&
161
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
161
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
162
163
test_must_fail git restore --pathspec-from-file=empty_list --source=HEAD^1 2>err &&
164
test_i18ngrep -e "you must specify path(s) to restore" err
t/t3601-rm-pathspec-file.sh
+1
-1
@@ -70,7 +70,7 @@ test_expect_success 'error conditions' '
70
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
71
72
test_must_fail git rm --pathspec-file-nul 2>err &&
73
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
73
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
74
75
>empty_list &&
76
test_must_fail git rm --pathspec-from-file=empty_list 2>err &&
t/t3704-add-pathspec-file.sh
+1
-1
@@ -150,7 +150,7 @@ test_expect_success 'error conditions' '
150
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
151
152
test_must_fail git add --pathspec-file-nul 2>err &&
153
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
153
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
154
155
# This case succeeds, but still prints to stderr
156
git add --pathspec-from-file=empty_list 2>err &&
t/t3909-stash-pathspec-file.sh
+1
-1
@@ -94,7 +94,7 @@ test_expect_success 'error conditions' '
94
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
95
96
test_must_fail git stash push --pathspec-file-nul 2>err &&
97
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err
97
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err
98
'
99
100
test_done
t/t7107-reset-pathspec-file.sh
+1
-1
@@ -166,7 +166,7 @@ test_expect_success 'error conditions' '
166
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
167
168
test_must_fail git reset --pathspec-file-nul 2>err &&
169
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
169
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
170
171
test_must_fail git reset --soft --pathspec-from-file=list 2>err &&
172
test_i18ngrep -e "fatal: Cannot do soft reset with paths" err &&
t/t7526-commit-pathspec-file.sh
+1
-1
@@ -153,7 +153,7 @@ test_expect_success 'error conditions' '
153
test_i18ngrep -e "--pathspec-from-file is incompatible with pathspec arguments" err &&
154
155
test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
156
- test_i18ngrep -e "--pathspec-file-nul requires --pathspec-from-file" err &&
156
+ test_i18ngrep -e "the option .--pathspec-file-nul. requires .--pathspec-from-file." err &&
157
158
test_must_fail git commit --pathspec-from-file=empty_list --include -m "Commit" 2>err &&
159
test_i18ngrep -e "No paths with --include/--only does not make sense." err &&