Skip to content

Commit 6fa00ee

Browse files
jnavilagitster
authored andcommitted
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 <[email protected]> Reviewed-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 408c5c5 commit 6fa00ee

21 files changed

+24
-24
lines changed

archive.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ static int parse_archive_args(int argc, const char **argv,
577577
if (remote)
578578
die(_("Unexpected option --remote"));
579579
if (exec)
580-
die(_("Option --exec can only be used together with --remote"));
580+
die(_("the option '%s' requires '%s'"), "--exec", "--remote");
581581
if (output)
582582
die(_("Unexpected option --output"));
583583
if (is_remote && args->extra_files.nr)

builtin/add.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
541541
die(_("options '%s' and '%s' cannot be used together"), "-A", "-u");
542542

543543
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");
545545

546546
if (chmod_arg && ((chmod_arg[0] != '-' && chmod_arg[0] != '+') ||
547547
chmod_arg[1] != 'x' || chmod_arg[2]))
@@ -573,7 +573,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
573573
PATHSPEC_SYMLINK_LEADING_PATH,
574574
prefix, pathspec_from_file, pathspec_file_nul);
575575
} 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");
577577
}
578578

579579
if (require_pathspec && pathspec.nr == 0) {

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
17581758
0,
17591759
prefix, opts->pathspec_from_file, opts->pathspec_file_nul);
17601760
} 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");
17621762
}
17631763

17641764
opts->pathspec.recursive = 1;

builtin/commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
367367
PATHSPEC_PREFER_FULL,
368368
prefix, pathspec_from_file, pathspec_file_nul);
369369
} 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");
371371
}
372372

373373
if (!pathspec.nr && (also || (only && !allow_empty &&

builtin/fast-export.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
12541254
usage_with_options (fast_export_usage, options);
12551255

12561256
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");
12581258

12591259
if (refspecs_list.nr) {
12601260
int i;

builtin/index-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1845,7 +1845,7 @@ int cmd_index_pack(int argc, const char **argv, const char *prefix)
18451845
if (!pack_name && !from_stdin)
18461846
usage(index_pack_usage);
18471847
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");
18491849
if (from_stdin && !startup_info->have_repository)
18501850
die(_("--stdin requires a git repository"));
18511851
if (from_stdin && hash_algo)

builtin/log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2112,7 +2112,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
21122112
if (creation_factor < 0)
21132113
creation_factor = RANGE_DIFF_CREATION_FACTOR_DEFAULT;
21142114
else if (!rdiff_prev)
2115-
die(_("--creation-factor requires --range-diff"));
2115+
die(_("the option '%s' requires '%s'"), "--creation-factor", "--range-diff");
21162116

21172117
if (rdiff_prev) {
21182118
if (!cover_letter && total != 1)

builtin/reset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
432432
PATHSPEC_PREFER_FULL,
433433
prefix, pathspec_from_file, pathspec_file_nul);
434434
} 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");
436436
}
437437

438438
unborn = !strcmp(rev, "HEAD") && get_oid("HEAD", &oid);
@@ -490,7 +490,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
490490
_(reset_type_names[reset_type]));
491491

492492
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");
494494

495495
prepare_repo_settings(the_repository);
496496
the_repository->settings.command_requires_full_index = 0;

builtin/rm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
278278
PATHSPEC_PREFER_CWD,
279279
prefix, pathspec_from_file, pathspec_file_nul);
280280
} 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");
282282
}
283283

284284
if (!pathspec.nr)

builtin/stash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ static int push_stash(int argc, const char **argv, const char *prefix,
17121712
PATHSPEC_PREFER_FULL | PATHSPEC_PREFIX_ORIGIN,
17131713
prefix, pathspec_from_file, pathspec_file_nul);
17141714
} 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");
17161716
}
17171717

17181718
return do_push_stash(&ps, stash_msg, quiet, keep_index, patch_mode,

0 commit comments

Comments
 (0)