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

RE: [PATCH v2 2/4] show-branch tests: modernize test code

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 17, 2021, 21:29 UTC
Message-ID
<60cbbe9d89cbd_1299208fa@natae.notmuch>
In-Reply-To
<patch-2.4-27f94abaed-20210617T105245Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason wrote:
Show 8 quoted lines
> Modernize test code added in ce567d1867a (Add test to show that
> show-branch misses out the 8th column, 2008-07-23) and
> 11ee57bc4c4 (sort_in_topological_order(): avoid setting a commit flag,
> 2008-07-23) to use test helpers.
> 
> I'm renaming "out" to "actual" for consistency with other tests, and
> introducing a "branches.sorted" file in the setup, to make it clear
> that it's important that the list be sorted in this particular way.
That is better.
> The "show-branch" output is indented with spaces, which would cause
> complaints under "git show --check" with an indented here-doc
> block. Let's prefix the lines with "> " to work around that, and to
> make it clear that the leading whitespace is important.

I'm not sure this is an improvement. To me the original code is just fine. Also, I don't think writing an 'expect' file belong in a setup step.

Additionally I would do this change in a separate patch.
Show 5 quoted lines
> We can also get rid of the hardcoding of "main" added here in
> 334afbc76fb (tests: mark tests relying on the current default for
> `init.defaultBranch`, 2020-11-18). For this test we're setting up an
> "initial" commit anyway, and now that we've moved over to test_commit
> we can reference that instead.
That's also good.

All the changes in this patch look good to me, however, they are smashed together in a way that makes the review harder, I see:

 1. Use test_commit
 2. Rename out to actual
 3. Use >actual instead of > actual
 4. Use test_seq instead of $numbers
 5. Use branches.sorted instead of branch$i
 6. Use test_config instead of git config
 7. Use internal sed 's/^ //' instead of outside cat

I'm on-board with 6 out of 7, but if these were done it at least 2 patches, they would be clearer. I in fact would prefer one patch per change (although maybe squash 3 with 2).

Cheers.
-- 
Felipe Contreras
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 12 of 17 in “show-branch: add missing tests, trivial color output fix”
  1. 0/4 show-branch: add missing tests, trivial color output fixÆvar Arnfjörð Bjarmason, Jun 14, 2021
  2. 3/4 show-branch: fix and test --color outputÆvar Arnfjörð Bjarmason, Jun 14, 2021
  3. 4/4 show-branch tests: add missing testsÆvar Arnfjörð Bjarmason, Jun 14, 2021
  4. Michael J GruberJun 15, 2021
  5. 1/4 show-branch tests: rename the one "show-branch" test fileÆvar Arnfjörð Bjarmason, Jun 14, 2021
  6. 2/4 show-branch tests: modernize test codeÆvar Arnfjörð Bjarmason, Jun 14, 2021
  7. Junio C HamanoJun 15, 2021
  8. 0/4 show-branch: add missing tests, trivial color output changeÆvar Arnfjörð Bjarmason, Jun 17, 2021
  9. 1/4 show-branch tests: rename the one "show-branch" test fileÆvar Arnfjörð Bjarmason, Jun 17, 2021
  10. Felipe ContrerasJun 17, 2021
  11. 2/4 show-branch tests: modernize test codeÆvar Arnfjörð Bjarmason, Jun 17, 2021
  12. Felipe ContrerasJun 17, 2021
  13. 4/4 show-branch tests: add missing testsÆvar Arnfjörð Bjarmason, Jun 17, 2021
  14. Felipe ContrerasJun 17, 2021
  15. 3/4 show-branch: don't <COLOR></RESET> for space charactersÆvar Arnfjörð Bjarmason, Jun 17, 2021
  16. Felipe ContrerasJun 17, 2021
  17. Felipe ContrerasJun 17, 2021

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.