diff mbox series

[v3,02/11] i18n: refactor "%s, %s and %s are mutually exclusive"

Message ID 4accf1629e55ae621053f27994ebc4eb59d6f0ff.1640804107.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Factorization of messages with similar meaning | expand

Commit Message

Jean-Noël Avila Dec. 29, 2021, 6:54 p.m. UTC
From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>

Use placeholders for constant tokens. The strings are turned into
"cannot be used together"

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
---
 builtin/difftool.c     | 2 +-
 builtin/log.c          | 2 +-
 builtin/worktree.c     | 2 +-
 diff.c                 | 2 +-
 t/t4209-log-pickaxe.sh | 6 +++---
 5 files changed, 7 insertions(+), 7 deletions(-)

Comments

Junio C Hamano Dec. 30, 2021, 10:26 p.m. UTC | #1
"Jean-Noël Avila via GitGitGadget"  <gitgitgadget@gmail.com> writes:

>  	if (use_stdout + rev.diffopt.close_file + !!output_directory > 1)
> -		die(_("--stdout, --output, and --output-directory are mutually exclusive"));
> +		die(_("options '%s', '%s' and '%s' cannot be used together"), "--stdout", "--output", "--output-directory");

We probably want to preserve the Oxford comma here, and unify the
ones that didn't use Oxford comma to use it.
Jean-Noël Avila Dec. 31, 2021, 5:05 p.m. UTC | #2
On Thursday, 30 December 2021 23:26:42 CET Junio C Hamano wrote:
> "Jean-Noël Avila via GitGitGadget"  <gitgitgadget@gmail.com> writes:
> 
> >  	if (use_stdout + rev.diffopt.close_file + !!output_directory > 1)
> > -		die(_("--stdout, --output, and --output-directory are mutually exclusive"));
> > +		die(_("options '%s', '%s' and '%s' cannot be used together"), "--stdout", "--output", "--output-directory");
> 
> We probably want to preserve the Oxford comma here, and unify the
> ones that didn't use Oxford comma to use it.
> 

Oh. I wasn't even aware of this holy war (https://en.wikipedia.org/wiki/Serial_comma). It would be good to add this style specification
for writing our messages and documents.

Will make another pass.

Thanks
diff mbox series

Patch

diff --git a/builtin/difftool.c b/builtin/difftool.c
index 4ee40fe3a06..c2b049aafc9 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -733,7 +733,7 @@  int cmd_difftool(int argc, const char **argv, const char *prefix)
 		die(_("--dir-diff is incompatible with --no-index"));
 
 	if (use_gui_tool + !!difftool_cmd + !!extcmd > 1)
-		die(_("--gui, --tool and --extcmd are mutually exclusive"));
+		die(_("options '%s', '%s' and '%s' cannot be used together"), "--gui", "--tool", "--extcmd");
 
 	if (use_gui_tool)
 		setenv("GIT_MERGETOOL_GUI", "true", 1);
diff --git a/builtin/log.c b/builtin/log.c
index fad93ad2fc1..705d58110b0 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1979,7 +1979,7 @@  int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		load_display_notes(&rev.notes_opt);
 
 	if (use_stdout + rev.diffopt.close_file + !!output_directory > 1)
-		die(_("--stdout, --output, and --output-directory are mutually exclusive"));
+		die(_("options '%s', '%s' and '%s' cannot be used together"), "--stdout", "--output", "--output-directory");
 
 	if (use_stdout) {
 		setup_pager();
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 9a520485769..b5ef19b2dda 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -503,7 +503,7 @@  static int add(int ac, const char **av, const char *prefix)
 	opts.checkout = 1;
 	ac = parse_options(ac, av, prefix, options, worktree_usage, 0);
 	if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
-		die(_("-b, -B, and --detach are mutually exclusive"));
+		die(_("options '%s', '%s' and '%s' cannot be used together"), "-b", "-B", "--detach");
 	if (lock_reason && !keep_locked)
 		die(_("--reason requires --lock"));
 	if (lock_reason)
diff --git a/diff.c b/diff.c
index 41076857428..8de1c49763c 100644
--- a/diff.c
+++ b/diff.c
@@ -4642,7 +4642,7 @@  void diff_setup_done(struct diff_options *options)
 		die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
 
 	if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_MASK))
-		die(_("-G, -S and --find-object are mutually exclusive"));
+		die(_("options '%s', '%s' and '%s' cannot be used together"), "-G", "-S", "--find-object");
 
 	if (HAS_MULTI_BITS(options->pickaxe_opts & DIFF_PICKAXE_KINDS_G_REGEX_MASK))
 		die(_("-G and --pickaxe-regex are mutually exclusive, use --pickaxe-regex with -S"));
diff --git a/t/t4209-log-pickaxe.sh b/t/t4209-log-pickaxe.sh
index 75795d0b492..4f820f8597d 100755
--- a/t/t4209-log-pickaxe.sh
+++ b/t/t4209-log-pickaxe.sh
@@ -63,13 +63,13 @@  test_expect_success 'usage' '
 	test_i18ngrep "switch.*requires a value" err &&
 
 	test_expect_code 128 git log -Gregex -Sstring 2>err &&
-	grep "mutually exclusive" err &&
+	grep "cannot be used together" err &&
 
 	test_expect_code 128 git log -Gregex --find-object=HEAD 2>err &&
-	grep "mutually exclusive" err &&
+	grep "cannot be used together" err &&
 
 	test_expect_code 128 git log -Sstring --find-object=HEAD 2>err &&
-	grep "mutually exclusive" err &&
+	grep "cannot be used together" err &&
 
 	test_expect_code 128 git log --pickaxe-all --find-object=HEAD 2>err &&
 	grep "mutually exclusive" err