git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] i18n: commit: mark message for translation

From
Jean-Noël AVILA <jn.avila@free.fr>
Date
Sep 20, 2016, 19:04 UTC
Message-ID
<1579845.fzuqLqrEJ8@cayenne>
In-Reply-To
<xmqq4m5begxj.fsf@gitster.mtv.corp.google.com>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
---
Instead of distillating change requests, I'd better do it by myself. Here is the reworked version of the patch.
 diff.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/diff.c b/diff.c
index c6da383..494f723 100644
--- a/diff.c
+++ b/diff.c
@@ -55,6 +55,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
 	GIT_COLOR_NORMAL,	/* FUNCINFO */
 };
 
+static NORETURN void die_want_option(const char *option_name)
+{
+	die(_("option '%s' requires a value"), option_name);
+}
+
 static int parse_diff_color_slot(const char *var)
 {
 	if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
@@ -3325,7 +3330,7 @@ void diff_setup_done(struct diff_options *options)
 	if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
 		count++;
 	if (count > 1)
-		die("--name-only, --name-status, --check and -s are mutually exclusive");
+		die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
 
 	/*
 	 * Most of the time we can say "there are changes"
@@ -3521,7 +3526,7 @@ static int stat_opt(struct diff_options *options, const char **av)
 			if (*arg == '=')
 				width = strtoul(arg + 1, &end, 10);
 			else if (!*arg && !av[1])
-				die("Option '--stat-width' requires a value");
+				die_want_option("--stat-width");
 			else if (!*arg) {
 				width = strtoul(av[1], &end, 10);
 				argcount = 2;
@@ -3530,7 +3535,7 @@ static int stat_opt(struct diff_options *options, const char **av)
 			if (*arg == '=')
 				name_width = strtoul(arg + 1, &end, 10);
 			else if (!*arg && !av[1])
-				die("Option '--stat-name-width' requires a value");
+				die_want_option("--stat-name-width");
 			else if (!*arg) {
 				name_width = strtoul(av[1], &end, 10);
 				argcount = 2;
@@ -3539,7 +3544,7 @@ static int stat_opt(struct diff_options *options, const char **av)
 			if (*arg == '=')
 				graph_width = strtoul(arg + 1, &end, 10);
 			else if (!*arg && !av[1])
-				die("Option '--stat-graph-width' requires a value");
+				die_want_option("--stat-graph-width");
 			else if (!*arg) {
 				graph_width = strtoul(av[1], &end, 10);
 				argcount = 2;
@@ -3548,7 +3553,7 @@ static int stat_opt(struct diff_options *options, const char **av)
 			if (*arg == '=')
 				count = strtoul(arg + 1, &end, 10);
 			else if (!*arg && !av[1])
-				die("Option '--stat-count' requires a value");
+				die_want_option("--stat-count");
 			else if (!*arg) {
 				count = strtoul(av[1], &end, 10);
 				argcount = 2;
-- 
2.10.0
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 11 in “i18n: commit: mark message for translation”
  1. 1/6 i18n: commit: mark message for translationVasco Almeida, Sep 19, 2016
  2. 2/6 i18n: connect: mark die messages for translationVasco Almeida, Sep 19, 2016
  3. 4/6 i18n: ident: mark hint for translationVasco Almeida, Sep 19, 2016
  4. 3/6 i18n: diff: mark die errors for translationVasco Almeida, Sep 19, 2016
  5. 5/6 i18n: notes-merge: mark die messages for translationVasco Almeida, Sep 19, 2016
  6. 6/6 i18n: stash: mark messages for translationVasco Almeida, Sep 19, 2016
  7. Junio C HamanoSep 19, 2016
  8. Jean-Noël AVILASep 19, 2016
  9. Junio C HamanoSep 19, 2016
  10. Jean-Noël AVILASep 20, 2016
  11. Junio C HamanoSep 21, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.