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

[PATCH] parseopt: do not translate empty help string

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 20, 2012, 18:24 UTC
Message-ID
<bcb1f4437760452f967737fddf26dff019d0f0b2.1345487066.git.trast@student.ethz.ch>

The gettext .po files have a header, but it looks like the translation specification for an empty string. This results in _("") actually returning that header.

Prevent parseopt from passing empty strings to gettext when it displays help about commands. In some instances it already did this, but git-grep's --or etc. caught another case.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 parse-options.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/parse-options.c b/parse-options.c
index c1c66bd..f95bbb2 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -562,7 +562,8 @@ static int usage_with_options_internal(struct parse_opt_ctx_t *ctx,
 			fputc('\n', outfile);
 			pad = USAGE_OPTS_WIDTH;
 		}
-		fprintf(outfile, "%*s%s\n", pad + USAGE_GAP, "", _(opts->help));
+		fprintf(outfile, "%*s%s\n", pad + USAGE_GAP, "",
+			*opts->help ? _(opts->help) : "");
 	}
 	fputc('\n', outfile);
 
-- 
1.7.12.rc1.203.gc3c8071
Next: Junio C Hamano
Message 1 of 6 in “parseopt: do not translate empty help string”
  1. parseopt: do not translate empty help stringThomas Rast, Aug 20, 2012
  2. Junio C HamanoAug 20, 2012
  3. Thomas RastAug 20, 2012
  4. Junio C HamanoAug 20, 2012
  5. Junio C HamanoAug 20, 2012
  6. Thomas RastAug 20, 2012

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.