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

Re: [PATCH v2 02/18] t7526: add tests for error conditions

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2019, 22:02 UTC
Message-ID
<xmqqr211cmxy.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<c7cd46d3a3bcbf4a5cfe2aa6aa71b3713801892b.1576511287.git.gitgitgadget@gmail.com>

"Alexandr Miloslavskiy via GitGitGadget" <gitgitgadget@gmail.com> writes:

> +	test_must_fail git commit --pathspec-from-file=- --interactive -m "Commit" <list 2>err &&
> +	test_i18ngrep "\-\-pathspec-from-file is incompatible with \-\-interactive/\-\-patc
h" err &&

What's with the overly-noisy quoting of dashes here? To match a string that happens to begin with a dash, either one of

	$ grep -e "-this string begins with and has-many-dashes-in-it" file
	$ grep "[-]this string begins with and has-many-dashes-in-it" file
would be sufficient and more idiomatic.
Or am I missing some other reason why the test is written this way?
Show 17 quoted lines
> +	test_must_fail git commit --pathspec-from-file=- --patch -m "Commit" <list 2>err &&
> +	test_i18ngrep "\-\-pathspec-from-file is incompatible with \-\-interactive/\-\-patch" err &&
> +
> +	test_must_fail git commit --pathspec-from-file=- -m "Commit" -- fileA.t <list 2>err &&
> +	test_i18ngrep "\-\-pathspec-from-file is incompatible with pathspec arguments" err &&
> +
> +	test_must_fail git commit --pathspec-file-nul -m "Commit" 2>err &&
> +	test_i18ngrep "\-\-pathspec-file-nul requires \-\-pathspec-from-file" err &&
> +
> +	test_must_fail git commit --pathspec-from-file=- --include -m "Commit" <empty_list 2>err &&
> +	test_i18ngrep "No paths with \-\-include/\-\-only does not make sense." err &&
> +
> +	test_must_fail git commit --pathspec-from-file=- --only -m "Commit" <empty_list 2>err &&
> +	test_i18ngrep "No paths with \-\-include/\-\-only does not make sense." err
> +'
> +
>  test_done
Previous: Alexandr Miloslavskiy via GitGitGadgetNext: Alexandr Miloslavskiy
Message 22 of 67 in “Extend --pathspec-from-file to git add, checkout”
  1. 00/16 Extend --pathspec-from-file to git add, checkoutAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  2. 02/16 commit: forbid --pathspec-from-file --allAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  3. Phillip WoodDec 16, 2019
  4. Alexandr MiloslavskiyDec 16, 2019
  5. 01/16 t7107, t7526: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  6. 06/16 doc: checkout: fix broken text referenceAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  7. 03/16 cmd_add: prepare for next patchAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  8. 11/16 parse_branchname_arg(): easier to understand variablesAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  9. 08/16 doc: restore: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  10. 10/16 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  11. 14/16 parse_branchname_arg(): refactor the decision makingAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  12. 15/16 t2024: cover more casesAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  13. 13/16 parse_branchname_arg(): update code commentsAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  14. 09/16 parse_branchname_arg(): extract part as new functionAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  15. 16/16 checkout, restore: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  16. 12/16 parse_branchname_arg(): introduce expect_commit_onlyAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  17. 05/16 doc: checkout: remove duplicate synopsisAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  18. 04/16 add: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  19. 07/16 doc: checkout: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 12, 2019
  20. 00/18 Extend --pathspec-from-file to git add, checkoutAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  21. 02/18 t7526: add tests for error conditionsAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  22. Junio C HamanoDec 18, 2019
  23. Alexandr MiloslavskiyDec 19, 2019
  24. 04/18 commit: forbid --pathspec-from-file --allAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  25. Phillip WoodDec 17, 2019
  26. Junio C HamanoDec 18, 2019
  27. Junio C HamanoDec 18, 2019
  28. Junio C HamanoDec 18, 2019
  29. Alexandr MiloslavskiyDec 19, 2019
  30. 05/18 cmd_add: prepare for next patchAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  31. 06/18 add: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  32. 01/18 t7107, t7526: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  33. Junio C HamanoDec 18, 2019
  34. Junio C HamanoDec 19, 2019
  35. Alexandr MiloslavskiyDec 19, 2019
  36. 09/18 doc: checkout: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  37. 08/18 doc: checkout: fix broken text referenceAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  38. 13/18 parse_branchname_arg(): easier to understand variablesAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  39. 14/18 parse_branchname_arg(): introduce expect_commit_onlyAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  40. 17/18 t2024: cover more casesAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  41. 15/18 parse_branchname_arg(): update code commentsAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  42. 18/18 checkout, restore: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  43. 12/18 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  44. 10/18 doc: restore: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  45. 11/18 parse_branchname_arg(): extract part as new functionAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  46. 07/18 doc: checkout: remove duplicate synopsisAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  47. 16/18 parse_branchname_arg(): refactor the decision makingAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  48. 03/18 t7107: add tests for error conditionsAlexandr Miloslavskiy via GitGitGadget, Dec 16, 2019
  49. 00/18 Extend --pathspec-from-file to git add, checkoutAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  50. 02/18 t7526: add tests for error conditionsAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  51. 01/18 t7107, t7526: directly test parse_pathspec_file()Alexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  52. 03/18 t7107: add tests for error conditionsAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  53. 04/18 commit: forbid --pathspec-from-file --allAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  54. 05/18 cmd_add: prepare for next patchAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  55. 07/18 doc: checkout: remove duplicate synopsisAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  56. 08/18 doc: checkout: fix broken text referenceAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  57. 09/18 doc: checkout: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  58. 06/18 add: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  59. 11/18 parse_branchname_arg(): extract part as new functionAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  60. 10/18 doc: restore: synchronize <pathspec> descriptionAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  61. 13/18 parse_branchname_arg(): easier to understand variablesAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  62. 17/18 t2024: cover more casesAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  63. 16/18 parse_branchname_arg(): refactor the decision makingAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  64. 14/18 parse_branchname_arg(): simplify argument eatingAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  65. 12/18 checkout: die() on ambiguous tracking branchesAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  66. 18/18 checkout, restore: support the --pathspec-from-file optionAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019
  67. 15/18 parse_branchname_arg(): update code commentsAlexandr Miloslavskiy via GitGitGadget, Dec 19, 2019

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.