Skip to content

Commit 246cac8

Browse files
jnavilagitster
authored andcommitted
i18n: turn even more messages into "cannot be used together" ones
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 <[email protected]> Reviewed-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d7d30ba commit 246cac8

23 files changed

+47
-41
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
566566

567567
if (pathspec_from_file) {
568568
if (pathspec.nr)
569-
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
569+
die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
570570

571571
parse_pathspec_file(&pathspec, PATHSPEC_ATTR,
572572
PATHSPEC_PREFER_FULL |

builtin/am.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,9 +2230,9 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
22302230
}
22312231

22322232
if (resume->mode == RESUME_SHOW_PATCH && new_value != resume->sub_mode)
2233-
return error(_("--show-current-patch=%s is incompatible with "
2234-
"--show-current-patch=%s"),
2235-
arg, valid_modes[resume->sub_mode]);
2233+
return error(_("options '%s=%s' and '%s=%s' "
2234+
"cannot be used together"),
2235+
"--show-current-patch", "--show-current-patch", arg, valid_modes[resume->sub_mode]);
22362236

22372237
resume->mode = RESUME_SHOW_PATCH;
22382238
resume->sub_mode = new_value;

builtin/cat-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ int cmd_cat_file(int argc, const char **argv, const char *prefix)
729729
}
730730

731731
if (force_path && batch.enabled) {
732-
error("--path=<path> incompatible with --batch");
732+
error("options '--path=<path>' and '--batch' cannot be used together");
733733
usage_with_options(cat_file_usage, options);
734734
}
735735

builtin/checkout.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,8 +1635,8 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
16351635
}
16361636

16371637
if ((!!opts->new_branch + !!opts->new_branch_force + !!opts->new_orphan_branch) > 1)
1638-
die(_("-%c, -%c and --orphan are mutually exclusive"),
1639-
cb_option, toupper(cb_option));
1638+
die(_("options '-%c', '-%c', and '%s' cannot be used together"),
1639+
cb_option, toupper(cb_option), "--orphan");
16401640

16411641
if (opts->overlay_mode == 1 && opts->patch_mode)
16421642
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,
17461746

17471747
if (opts->pathspec_from_file) {
17481748
if (opts->pathspec.nr)
1749-
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
1749+
die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
17501750

17511751
if (opts->force_detach)
17521752
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--detach");

builtin/clone.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
900900

901901
if (option_bare) {
902902
if (option_origin)
903-
die(_("--bare and --origin %s options are incompatible."),
904-
option_origin);
903+
die(_("options '%s' and '%s %s' cannot be used together"),
904+
"--bare", "--origin", option_origin);
905905
if (real_git_dir)
906906
die(_("options '%s' and '%s' cannot be used together"), "--bare", "--separate-git-dir");
907907
option_no_checkout = 1;

builtin/commit.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static const char *prepare_index(const char **argv, const char *prefix,
361361
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "-a");
362362

363363
if (pathspec.nr)
364-
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
364+
die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
365365

366366
parse_pathspec_file(&pathspec, 0,
367367
PATHSPEC_PREFER_FULL,
@@ -799,7 +799,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
799799

800800
if (!strcmp(fixup_prefix, "amend")) {
801801
if (have_option_m)
802-
die(_("cannot combine -m with --fixup:%s"), fixup_message);
802+
die(_("options '%s' and '%s:%s' cannot be used together"), "-m", "--fixup", fixup_message);
803803
prepare_amend_commit(commit, &sb, &ctx);
804804
}
805805
} 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[]) {
12291229
die(_("You are in the middle of a cherry-pick -- cannot reword."));
12301230
}
12311231
if (argc)
1232-
die(_("cannot combine reword option of --fixup with path '%s'"), *argv);
1232+
die(_("reword option of '%s' and path '%s' cannot be used together"), "--fixup", *argv);
12331233
if (patch_interactive || interactive || all || also || only)
1234-
die(_("reword option of --fixup is mutually exclusive with --patch/--interactive/--all/--include/--only"));
1234+
die(_("reword option of '%s' and '%s' cannot be used together"),
1235+
"--fixup", "--patch/--interactive/--all/--include/--only");
12351236
}
12361237

12371238
static int parse_and_validate_options(int argc, const char *argv[],

builtin/describe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
670670
}
671671
describe("HEAD", 1);
672672
} else if (dirty) {
673-
die(_("--dirty is incompatible with commit-ishes"));
673+
die(_("option '%s' and commit-ishes cannot be used together"), "--dirty");
674674
} else if (broken) {
675-
die(_("--broken is incompatible with commit-ishes"));
675+
die(_("option '%s' and commit-ishes cannot be used together"), "--broken");
676676
} else {
677677
while (argc-- > 0)
678678
describe(*argv++, argc == 0);

builtin/rebase.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
14601460

14611461
if (i >= 0) {
14621462
if (is_merge(&options))
1463-
die(_("cannot combine apply options with "
1464-
"merge options"));
1463+
die(_("apply options and merge options "
1464+
"cannot be used together"));
14651465
else
14661466
options.type = REBASE_APPLY;
14671467
}

builtin/reset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
426426
die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--patch");
427427

428428
if (pathspec.nr)
429-
die(_("--pathspec-from-file is incompatible with pathspec arguments"));
429+
die(_("'%s' and pathspec arguments cannot be used together"), "--pathspec-from-file");
430430

431431
parse_pathspec_file(&pathspec, 0,
432432
PATHSPEC_PREFER_FULL,

builtin/rev-list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
676676
if (revs.count &&
677677
(revs.tag_objects || revs.tree_objects || revs.blob_objects) &&
678678
(revs.left_right || revs.cherry_mark))
679-
die(_("marked counting is incompatible with --objects"));
679+
die(_("marked counting and '%s' cannot be used together"), "--objects");
680680

681681
save_commit_buffer = (revs.verbose_header ||
682682
revs.grep_filter.pattern_list ||

0 commit comments

Comments
 (0)