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

Re: [PATCH 1/3] test-lib: Document short options in t/README

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 28, 2014, 17:20 UTC
Message-ID
<xmqqvbuyb5po.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqd2h7fvkw.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 23 quoted lines
> Ilya Bobyr <ilya.bobyr@gmail.com> writes:
>
>> If there is decision on how shortening should work for all the
>> options, maybe I could add a paragraph on that and make existing
>> options more consistent.
>
> We should strive to make the following from gitcli.txt apply
> throughout the system:
>
>  * many commands allow a long option `--option` to be abbreviated
>    only to their unique prefix (e.g. if there is no other option
>    whose name begins with `opt`, you may be able to spell `--opt` to
>    invoke the `--option` flag), but you should fully spell them out
>    when writing your scripts; later versions of Git may introduce a
>    new option whose name shares the same prefix, e.g. `--optimize`,
>    to make a short prefix that used to be unique no longer unique.
>
>> If so, '--valgrind' becomes impossible to shorten because there
>> is '--valgrind-only' that is a separate option.  Same for
>> '--verbose'  and '--verbose-only'.
>
> Correct.  If you really cared, --valgrind={yes,no,only} would be (or
> have been) a better possibility, though.

Also, these existing bits are simply being lazy. You do not have to emulate and spread the laziness.

 t/test-lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 87f327f..f37973a 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -209,10 +209,10 @@ do
 	--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
 		valgrind=memcheck
 		shift ;;
-	--valgrind=*)
+	--va=*|--val=*|--valg=*|--valgr=*|--valgri=*|--valgrin=*|--valgrind=*)
 		valgrind=$(expr "z$1" : 'z[^=]*=\(.*\)')
 		shift ;;
-	--valgrind-only=*)
+  	--valgrind-o=*|--valgrind-on=*|--valgrind-onl=*|--valgrind-only=*)
 		valgrind_only=$(expr "z$1" : 'z[^=]*=\(.*\)')
 		shift ;;
 	--tee)
Previous: Junio C HamanoNext: Eric Sunshine
Message 8 of 23 in “Better control of the tests run by a test suite”
  1. Better control of the tests run by a test suiteIlya Bobyr, Mar 24, 2014
  2. 1/3 test-lib: Document short options in t/READMEIlya Bobyr, Mar 24, 2014
  3. Ramsay JonesMar 24, 2014
  4. Ilya BobyrMar 24, 2014
  5. Junio C HamanoMar 25, 2014
  6. Ilya BobyrMar 27, 2014
  7. Junio C HamanoMar 27, 2014
  8. Junio C HamanoMar 28, 2014
  9. Eric SunshineMar 25, 2014
  10. 2/3 test-lib: tests skipped by GIT_SKIP_TESTS say soIlya Bobyr, Mar 24, 2014
  11. 3/3 test-lib: '--run' to run only specific testsIlya Bobyr, Mar 24, 2014
  12. Jeff KingMar 24, 2014
  13. Junio C HamanoMar 25, 2014
  14. Ilya BobyrMar 27, 2014
  15. Better control of the tests run by a test suiteIlya Bobyr, Mar 27, 2014
  16. 1/3 test-lib: Document short options in t/READMEIlya Bobyr, Mar 27, 2014
  17. 2/3 test-lib: tests skipped by GIT_SKIP_TESTS say soIlya Bobyr, Mar 27, 2014
  18. 3/3 test-lib: '--run' to run only specific testsIlya Bobyr, Mar 27, 2014
  19. Eric SunshineMar 28, 2014
  20. Ilya BobyrMar 28, 2014
  21. Eric SunshineMar 30, 2014
  22. Junio C HamanoMar 31, 2014
  23. David TranMar 31, 2014

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.