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

Re: [PATCH v4] help.c: expand options for help.autocorrect

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 25, 2020, 20:49 UTC
Message-ID
<xmqqk0u9duvo.fsf@gitster.c.googlers.com>
In-Reply-To
<20201125183309.GF8396@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 7 quoted lines
>> +		grep "is not a git command" actual &&
>> +		test_line_count = 1 actual
>
> The two branches of this condition are in the wrong order, as it
> doesn't check the expected error message in normal mode, but it does
> grep for the specific translated error message when run with
> GIT_TEST_GETTEXT_POISON=1 which then fails the test.
Correct.
Show 5 quoted lines
> I think we should simply use 'test_i18ngrep' instead of that whole
> if-else block.  
> ...
> I wonder what that 'test_line_count = 1' is supposed to check, and am
> not sure that it's really necessary.
I think it is to make sure that there is no other message emitted.

I prefer not to rely on the current implementation of poison that makes any message a single line message "# GETTEXT POISON #" that is an incomplete line. In other words,

	main() {
	printf(_("%s.\n"), "hello");
	error(_("goodbye"));
	exit(0);
	}

would give you a single line output with the current implementation, but there is no guarantee we won't improve the poisoning in the future.

Previous: SZEDER Gábor
Message 5 of 5 in “help.c: expand options for help.autocorrect”
  1. help.c: expand options for help.autocorrectDrew DeVault, Nov 18, 2020
  2. Junio C HamanoNov 18, 2020
  3. Junio C HamanoNov 18, 2020
  4. SZEDER GáborNov 25, 2020
  5. Junio C HamanoNov 25, 2020

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.