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

Re: [PATCH v2 01/18] t7107, t7526: directly test parse_pathspec_file()

From
AMAlexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Date
Dec 19, 2019, 17:19 UTC
Message-ID
<0cf9d6a8-f804-c828-28f5-e60089190167@syntevo.com>
In-Reply-To
<xmqqwoatcn5u.fsf@gitster-ct.c.googlers.com>
On 18.12.2019 22:57, Junio C Hamano wrote:
Show 18 quoted lines
>> In my previous patches, `parse_pathspec_file()` was tested indirectly by
>> invoking `git reset` and `git commit` with properly crafted inputs. This
>> has some disadvantages:
>> 1) A number of tests are copy&pasted for every command where
>>     `--pathspec-from-file` is supported. With just two commands, it
>>     wasn't too bad, but I'm going to extend support to many more
>>     commands, which would make a handful of low-value tests.
>> 2) Tests are located in suboptimal test packages
>> 3) Tests are indirect
> 
> That cuts both ways.  For a developer who is too narrowly focused
> (because s/he spent enough time staring at the code), testing the
> underlying machinery in a more direct way does feel attractive, but
> at the same time, what matters to the end users is how well the
> feature, when integrated into the commands they use (not the test
> scaffolding like the "test-parse-pathspec-file" command), works.
> 
> So "indirect" is not necessarily a bad thing.
I agree that it cuts both ways.

Just recently I had an (unrelated) discussion with Johannes Schindelin who forced me to drop 2 of 3 tests (where #3 also by chance covered #1 #2) in some other PR, because too many tests is also evil.

To verify: I see 13 git commands that could benefit from --pathspec-from-file. There are 6 tests that in fact test underlying machinery, which can't be easily influenced by bugs in command's code. That makes 12*6 = 72 tests that are copy&pasted and doesn't test anything new.

Do you suggest to return _all_ tests back into every command? (but also keep the new direct tests, I assume)

Previous: Junio C HamanoNext: Alexandr Miloslavskiy via GitGitGadget
Message 35 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.