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

Re: [PATCH 2/4] t2405: use git -C and test_commit -C instead of subshells

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 17, 2020, 20:32 UTC
Message-ID
<xmqq5zh9esdl.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cQgh+gmrDwSqJz1hHViBxTP6UDkuHjKTRLbackcxeQE9A@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 9 quoted lines
> On Fri, Jan 17, 2020 at 7:24 AM Philippe Blain via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
>> The subshells used in the setup phase of this test are unnecessary.
>> Remove them by using 'git -C' and 'test_commit -C'.
>
> The subshells may not be necessary, but the code feels cleaner before
> this patch is applied since all the added "-C foo/bar" noise hurts
> readability. So, I'm "meh" on this patch and wouldn't complain if it
> was dropped (though I don't insist upon it).

I dunno. Each of these subshells did not do much after going into its subdirectory, so repetition of "-C foo/bar" did not bother me that much.

Show 15 quoted lines
>> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
>> ---
>> diff --git a/t/t2405-worktree-submodule.sh b/t/t2405-worktree-submodule.sh
>> @@ -6,32 +6,16 @@ test_description='Combination of submodules and multiple worktrees'
>> -               git commit -m "file1 updated"
>> +       git -C origin/main commit -m "add sub" &&
>> +       test_commit -C origin/sub "file1-updated" file1 file1updated &&
>> @@ -49,7 +33,7 @@ test_expect_success 'checkout main' '
>> -       grep "file1 updated" out
>> +       grep "file1-updated" out
>
> Why this change? Is it because test_commit() mishandles the whitespace
> in the commit message? If so, it might deserve mention in the commit
> message of this patch. (Even better would be to fix test_commit(), if
> that is the case.)
FWIW I had the same reaction on that dash in "file1 updated".
Previous: Eric SunshineNext: Philippe Blain
Message 5 of 24 in “checkout/reset/read-tree: fix --recurse-submodules in linked worktree”
  1. 0/4 checkout/reset/read-tree: fix --recurse-submodules in linked worktreePhilippe Blain via GitGitGadget, Jan 17, 2020
  2. 1/4 t7410: rename to t2405-worktree-submodule.shPhilippe Blain via GitGitGadget, Jan 17, 2020
  3. 2/4 t2405: use git -C and test_commit -C instead of subshellsPhilippe Blain via GitGitGadget, Jan 17, 2020
  4. Eric SunshineJan 17, 2020
  5. Junio C HamanoJan 17, 2020
  6. Philippe BlainJan 18, 2020
  7. 3/4 t2405: clarify test descriptions and simplify testPhilippe Blain via GitGitGadget, Jan 17, 2020
  8. Eric SunshineJan 17, 2020
  9. Philippe BlainJan 19, 2020
  10. Eric SunshineJan 19, 2020
  11. 4/4 submodule.c: use get_git_dir() instead of get_git_common_dir()Philippe Blain via GitGitGadget, Jan 17, 2020
  12. Derrick StoleeJan 17, 2020
  13. Philippe BlainJan 18, 2020
  14. Derrick StoleeJan 17, 2020
  15. 0/4 checkout/reset/read-tree: fix --recurse-submodules in linked worktreePhilippe Blain via GitGitGadget, Jan 21, 2020
  16. 1/4 t7410: rename to t2405-worktree-submodule.shPhilippe Blain via GitGitGadget, Jan 21, 2020
  17. 2/4 t2405: use git -C and test_commit -C instead of subshellsPhilippe Blain via GitGitGadget, Jan 21, 2020
  18. 3/4 t2405: clarify test descriptions and simplify testPhilippe Blain via GitGitGadget, Jan 21, 2020
  19. 4/4 submodule.c: use get_git_dir() instead of get_git_common_dir()Philippe Blain via GitGitGadget, Jan 21, 2020
  20. Philippe BlainJan 22, 2020
  21. Junio C HamanoJan 22, 2020
  22. Philippe BlainJan 22, 2020
  23. Philippe BlainJan 24, 2020
  24. Junio C HamanoJan 24, 2020

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.