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

Re: [PATCH v3] bugreport: reject positional arguments

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2023, 00:33 UTC
Message-ID
<xmqqpm0xeyp9.fsf@gitster.g>
In-Reply-To
<xmqqv8apez0o.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> writes:
Show 25 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
>> It is rather unfortunate that test_i18ngrep was deprecated without
>> providing an alternative that offers the same debugging
>> experience.
>
> The primary thing test_i18ngrep did was to _SKIP_ certain test that
> looked for an expected string in "C" locale from the output when the
> tests were run under a tainted localization mode.  The tests that
> looked for strings in messages that are *not* to be localized used
> "grep".  Tests that (unfortunately) had to match human-readable
> messages had to work around the tainted localization test to use
> test_i18ngrep.
>
>> When test_i18ngrep fails it prints a message with the
>> pattern and text that failed to match so it is easy to see where the
>> test failed. If grep fails there is no output and so unless the test
>> is run with "-x" it can be hard to see which command caused the test
>> to fail.
>
> We could rename test_i18ngrep to test_grep (and make test_i18ngrep
> into a thin wrapper with warnings).
>
> 	test_grep -e must-exist file &&
> 	test_grep ! -e must-not-exist file

... as the only remaining part in test_18ngrep has no hack to work around the tainted localization tests, so "was deprecated without" is a bit too strong. There is nothing we have lost yet.

 t/test-lib-functions.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git c/t/test-lib-functions.sh w/t/test-lib-functions.sh
index 2f8868caa1..c50bc18861 100644
--- c/t/test-lib-functions.sh
+++ w/t/test-lib-functions.sh
@@ -1208,14 +1208,16 @@ test_cmp_bin () {
 	cmp "$@"
 }
 
-# Wrapper for grep which used to be used for
-# GIT_TEST_GETTEXT_POISON=false. Only here as a shim for other
-# in-flight changes. Should not be used and will be removed soon.
+# Deprecated - do not use this in new code
 test_i18ngrep () {
+	test_grep "$@"
+}
+
+test_grep () {
 	eval "last_arg=\${$#}"
 
 	test -f "$last_arg" ||
-	BUG "test_i18ngrep requires a file to read as the last parameter"
+	BUG "test_grep requires a file to read as the last parameter"
 
 	if test $# -lt 2 ||
 	   { test "x!" = "x$1" && test $# -lt 3 ; }
Previous: Junio C HamanoNext: Junio C Hamano
Message 14 of 28 in “git bugreport with invalid CLI argument does not report error”
  1. SheikOct 25, 2023
  2. Emily ShafferOct 25, 2023
  3. Eric SunshineOct 25, 2023
  4. bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  5. Eric SunshineOct 26, 2023
  6. Dragan SimicOct 26, 2023
  7. Eric SunshineOct 26, 2023
  8. Dragan SimicOct 26, 2023
  9. bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  10. Eric SunshineOct 26, 2023
  11. Phillip WoodOct 27, 2023
  12. Junio C HamanoOct 30, 2023
  13. Junio C HamanoOct 30, 2023
  14. Junio C HamanoOct 30, 2023
  15. Junio C HamanoOct 30, 2023
  16. Phillip WoodOct 30, 2023
  17. Junio C HamanoOct 30, 2023
  18. Junio C HamanoOct 31, 2023
  19. 0/2 Deprecate test_i18ngrep furtherJunio C Hamano, Oct 31, 2023
  20. 1/2 test framework: further deprecate test_i18ngrepJunio C Hamano, Oct 31, 2023
  21. 2/2 tests: teach callers of test_i18ngrep to use test_grepJunio C Hamano, Oct 31, 2023
  22. Phillip WoodNov 1, 2023
  23. Junio C HamanoNov 1, 2023
  24. 0/2 bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023
  25. Eric SunshineOct 26, 2023
  26. 1/2 t0091-bugreport: stop using i18ngrepemilyshaffer@google.com, Oct 26, 2023
  27. Junio C HamanoOct 29, 2023
  28. 2/2 bugreport: reject positional argumentsemilyshaffer@google.com, Oct 26, 2023

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.