git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jean-Noël Avila via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Bagas Sanjaya" <bagasdotme@gmail.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Jean-Noël Avila" <jn.avila@free.fr>,
	"Jean-Noël Avila" <jn.avila@free.fr>
Subject: [PATCH v2 6/6] i18n: factorize "bad argument" messages
Date: Sat, 02 Apr 2022 16:10:53 +0000	[thread overview]
Message-ID: <febe64a8a069dd81523c33a93cfea9553e40c283.1648915853.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1181.v2.git.1648915853.gitgitgadget@gmail.com>

From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>

We also quote the placeholders as they replace constant strings.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
---
 builtin/bisect--helper.c | 2 +-
 builtin/commit-graph.c   | 2 +-
 builtin/config.c         | 2 +-
 builtin/env--helper.c    | 2 +-
 builtin/gc.c             | 4 ++--
 diff.c                   | 4 ++--
 grep.c                   | 2 +-
 send-pack.c              | 2 +-
 submodule-config.c       | 8 ++++----
 submodule.c              | 2 +-
 t/t1300-config.sh        | 2 +-
 t/t7900-maintenance.sh   | 4 ++--
 12 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index 8b2b259ff0d..3ed8a5f40b6 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -268,7 +268,7 @@ static int bisect_write(const char *state, const char *rev,
 	} else if (one_of(state, terms->term_good, "skip", NULL)) {
 		strbuf_addf(&tag, "refs/bisect/%s-%s", state, rev);
 	} else {
-		res = error(_("Bad bisect_write argument: %s"), state);
+		res = error(_("bad '%s' argument: '%s'"), "bisect_write", state);
 		goto finish;
 	}
 
diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
index 51c4040ea6c..913478bb029 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -134,7 +134,7 @@ static int write_option_parse_split(const struct option *opt, const char *arg,
 	else if (!strcmp(arg, "replace"))
 		*flags = COMMIT_GRAPH_SPLIT_REPLACE;
 	else
-		die(_("unrecognized --split argument, %s"), arg);
+		die(_("bad '%s' argument: '%s'"), "--split", arg);
 
 	return 0;
 }
diff --git a/builtin/config.c b/builtin/config.c
index e7b88a9c08d..2ac36e4f641 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -106,7 +106,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
 		else if (!strcmp(arg, "color"))
 			new_type = TYPE_COLOR;
 		else
-			die(_("unrecognized --type argument, %s"), arg);
+			die(_("bad '%s' argument: '%s'"), "--type", arg);
 	}
 
 	to_type = opt->value;
diff --git a/builtin/env--helper.c b/builtin/env--helper.c
index 27349098b07..49790dfa2fb 100644
--- a/builtin/env--helper.c
+++ b/builtin/env--helper.c
@@ -24,7 +24,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
 	else if (!strcmp(arg, "ulong"))
 		*cmdmode = ENV_HELPER_TYPE_ULONG;
 	else
-		die(_("unrecognized --type argument, %s"), arg);
+		die(_("bad '%s' argument: '%s'"), "--type", arg);
 
 	return 0;
 }
diff --git a/builtin/gc.c b/builtin/gc.c
index c062d7bceeb..cca6987fcbd 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -750,7 +750,7 @@ static int maintenance_opt_schedule(const struct option *opt, const char *arg,
 	*priority = parse_schedule(arg);
 
 	if (!*priority)
-		die(_("unrecognized --schedule argument '%s'"), arg);
+		die(_("bad '%s' argument: '%s'"), "--schedule", arg);
 
 	return 0;
 }
@@ -2393,7 +2393,7 @@ static int maintenance_opt_scheduler(const struct option *opt, const char *arg,
 
 	*scheduler = parse_scheduler(arg);
 	if (*scheduler == SCHEDULER_INVALID)
-		return error(_("unrecognized --scheduler argument '%s'"), arg);
+		return error(_("bad '%s' argument: '%s'"), "--scheduler", arg);
 	return 0;
 }
 
diff --git a/diff.c b/diff.c
index 6b22946cd0e..c74f6e7b920 100644
--- a/diff.c
+++ b/diff.c
@@ -5010,7 +5010,7 @@ static int diff_opt_color_moved(const struct option *opt,
 	} else {
 		int cm = parse_color_moved(arg);
 		if (cm < 0)
-			return error(_("bad --color-moved argument: %s"), arg);
+			return error(_("bad '%s' argument: '%s'"), "--color-moved", arg);
 		options->color_moved = cm;
 	}
 	return 0;
@@ -5334,7 +5334,7 @@ static int diff_opt_word_diff(const struct option *opt,
 		else if (!strcmp(arg, "none"))
 			options->word_diff = DIFF_WORDS_NONE;
 		else
-			return error(_("bad --word-diff argument: %s"), arg);
+			return error(_("bad '%s' argument: '%s'"), "--word-diff", arg);
 	} else {
 		if (options->word_diff == DIFF_WORDS_NONE)
 			options->word_diff = DIFF_WORDS_PLAIN;
diff --git a/grep.c b/grep.c
index 82eb7da1022..6aabfc58bb3 100644
--- a/grep.c
+++ b/grep.c
@@ -43,7 +43,7 @@ static int parse_pattern_type_arg(const char *opt, const char *arg)
 		return GREP_PATTERN_TYPE_FIXED;
 	else if (!strcmp(arg, "perl"))
 		return GREP_PATTERN_TYPE_PCRE;
-	die("bad %s argument: %s", opt, arg);
+	die("bad '%s' argument: '%s'", opt, arg);
 }
 
 define_list_config_array_extra(color_grep_slots, {"match"});
diff --git a/send-pack.c b/send-pack.c
index bc0fcdbb000..68205e8a913 100644
--- a/send-pack.c
+++ b/send-pack.c
@@ -36,7 +36,7 @@ int option_parse_push_signed(const struct option *opt,
 		*(int *)(opt->value) = SEND_PACK_PUSH_CERT_IF_ASKED;
 		return 0;
 	}
-	die("bad %s argument: %s", opt->long_name, arg);
+	die("bad '%s' argument: '%s'", opt->long_name, arg);
 }
 
 static void feed_object(const struct object_id *oid, FILE *fh, int negative)
diff --git a/submodule-config.c b/submodule-config.c
index 29668b0620d..76264c6e6b6 100644
--- a/submodule-config.c
+++ b/submodule-config.c
@@ -292,7 +292,7 @@ static int parse_fetch_recurse(const char *opt, const char *arg,
 		 * git-completion.bash when you add new options.
 		 */
 		if (die_on_error)
-			die("bad %s argument: %s", opt, arg);
+			die("bad '%s' argument: '%s'", opt, arg);
 		else
 			return RECURSE_SUBMODULES_ERROR;
 	}
@@ -342,7 +342,7 @@ static int parse_update_recurse(const char *opt, const char *arg,
 		return RECURSE_SUBMODULES_OFF;
 	default:
 		if (die_on_error)
-			die("bad %s argument: %s", opt, arg);
+			die("bad '%s' argument: '%s'", opt, arg);
 		return RECURSE_SUBMODULES_ERROR;
 	}
 }
@@ -359,7 +359,7 @@ static int parse_push_recurse(const char *opt, const char *arg,
 	case 1:
 		/* There's no simple "on" value when pushing */
 		if (die_on_error)
-			die("bad %s argument: %s", opt, arg);
+			die("bad '%s' argument: '%s'", opt, arg);
 		else
 			return RECURSE_SUBMODULES_ERROR;
 	case 0:
@@ -376,7 +376,7 @@ static int parse_push_recurse(const char *opt, const char *arg,
 		 * git-completion.bash when you add new modes.
 		 */
 		else if (die_on_error)
-			die("bad %s argument: %s", opt, arg);
+			die("bad '%s' argument: '%s'", opt, arg);
 		else
 			return RECURSE_SUBMODULES_ERROR;
 	}
diff --git a/submodule.c b/submodule.c
index 5ace18a7d94..c08477762d9 100644
--- a/submodule.c
+++ b/submodule.c
@@ -470,7 +470,7 @@ void handle_ignore_submodules_arg(struct diff_options *diffopt,
 	else if (!strcmp(arg, "dirty"))
 		diffopt->flags.ignore_dirty_submodules = 1;
 	else if (strcmp(arg, "none"))
-		die(_("bad --ignore-submodules argument: %s"), arg);
+		die(_("bad '%s' argument: '%s'"), "--ignore-submodules", arg);
 	/*
 	 * Please update _git_status() in git-completion.bash when you
 	 * add new options
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 7dd9b325d90..69cb3af0885 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -2215,7 +2215,7 @@ test_expect_success 'unset type specifiers may be reset to conflicting ones' '
 
 test_expect_success '--type rejects unknown specifiers' '
 	test_must_fail git config --type=nonsense section.foo 2>error &&
-	test_i18ngrep "unrecognized --type argument" error
+	test_i18ngrep "bad '\''--type'\'' argument" error
 '
 
 test_expect_success '--replace-all does not invent newlines' '
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
index 74aa6384755..c5e62e95533 100755
--- a/t/t7900-maintenance.sh
+++ b/t/t7900-maintenance.sh
@@ -401,7 +401,7 @@ test_expect_success '--auto and --schedule incompatible' '
 
 test_expect_success 'invalid --schedule value' '
 	test_must_fail git maintenance run --schedule=annually 2>err &&
-	test_i18ngrep "unrecognized --schedule" err
+	test_i18ngrep "bad '\''--schedule'\''" err
 '
 
 test_expect_success '--schedule inheritance weekly -> daily -> hourly' '
@@ -529,7 +529,7 @@ test_expect_success !MINGW 'register and unregister with regex metacharacters' '
 
 test_expect_success 'start --scheduler=<scheduler>' '
 	test_expect_code 129 git maintenance start --scheduler=foo 2>err &&
-	test_i18ngrep "unrecognized --scheduler argument" err &&
+	test_i18ngrep "bad '\''--scheduler'\'' argument" err &&
 
 	test_expect_code 129 git maintenance start --no-scheduler 2>err &&
 	test_i18ngrep "unknown option" err &&
-- 
gitgitgadget

  parent reply	other threads:[~2022-04-02 16:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-20 21:54 [PATCH 0/7] More i18n fixes Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 1/7] i18n: factorize generic failure messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 2/7] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya via GitGitGadget
2022-03-21  5:22   ` Bagas Sanjaya
2022-03-20 21:54 ` [PATCH 3/7] i18n: factorize "bad argument" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 4/7] i18n: factorize "Server does not support foo" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 5/7] i18n: factorize "foo does not take arguments" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 6/7] i18n: factorize read-cache error messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 7/7] i18n: factorize unrecognized options arguments messages Jean-Noël Avila via GitGitGadget
2022-03-21  6:48 ` [PATCH 0/7] More i18n fixes Johannes Sixt
2022-03-21 13:59   ` Ævar Arnfjörð Bjarmason
2022-03-21 19:03     ` Junio C Hamano
2022-03-21 20:13       ` Jean-Noël AVILA
2022-03-21 20:35     ` Jean-Noël AVILA
2022-04-02 16:10 ` [PATCH v2 0/6] " Jean-Noël Avila via GitGitGadget
2022-04-02 16:10   ` [PATCH v2 1/6] i18n: factorize generic failure messages Jean-Noël Avila via GitGitGadget
2022-04-03  5:56     ` Bagas Sanjaya
2022-04-03 14:34       ` Ævar Arnfjörð Bjarmason
2022-04-03 14:47     ` Ævar Arnfjörð Bjarmason
2022-04-02 16:10   ` [PATCH v2 2/6] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya via GitGitGadget
2022-04-02 16:10   ` [PATCH v2 3/6] i18n: factorize server support messages in fetch-pack Jean-Noël Avila via GitGitGadget
2022-04-02 16:10   ` [PATCH v2 4/6] i18n: factorize "foo does not take arguments" messages Jean-Noël Avila via GitGitGadget
2022-04-03 14:39     ` Ævar Arnfjörð Bjarmason
2022-04-03 22:21       ` Junio C Hamano
2022-04-02 16:10   ` [PATCH v2 5/6] i18n: factorize read-cache error messages Jean-Noël Avila via GitGitGadget
2022-04-03 22:29     ` Junio C Hamano
2022-04-02 16:10   ` Jean-Noël Avila via GitGitGadget [this message]
2022-04-03 14:41     ` [PATCH v2 6/6] i18n: factorize "bad argument" messages Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=febe64a8a069dd81523c33a93cfea9553e40c283.1648915853.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=avarab@gmail.com \
    --cc=bagasdotme@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=jn.avila@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).