Thread (11 messages) 11 messages, 4 authors, 2020-12-08

Re: [PATCH] submodules: fix of regression on fetching of non-init subsub-repo

From: Eric Sunshine <hidden>
Date: 2020-12-07 08:41:34

On Mon, Dec 7, 2020 at 3:29 AM Peter Kästle [off-list ref] wrote:
On 04.12.20 19:06, Eric Sunshine wrote:
quoted
On Fri, Dec 4, 2020 at 10:25 AM Peter Kaestle [off-list ref] wrote:
quoted
+       ! git -C main fetch --recurse-submodules |&
+               grep -v -m1 "Fetching submodule sub$" &&
We want the test scripts to be portable, thus avoid Bashisms such as `|&`.
     git -C main fetch --recurse-submodules >out 2>&1 &&
     ! grep -v -m1 "Fetching submodule sub$" &&
In general I agree, but for this special test case, it's required to
have the two commands connected by a pipe, as the grep needs to kill the
git call in error case.  Otherwise for this regression git would go for
an infinite recursion loop.

Of course, we can go for a "git 2>&1 | grep" solution.
In that case, an in-code comment explaining why the output of `git`
must be piped to `grep` would be helpful since it is not uncommon for
people to "modernize" test code as they are working in the vicinity,
and removing such pipes is one of the modernizations often made. A
comment would help avoid such a change.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help