Re: [PATCH] apply: fix new-style empty context line triggering incomplete-line check
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Mar 18, 2026, 16:36 UTC
- Message-ID
- <CALnO6CDNwa8Ez4Ug0f8zNyxF1n3C_j8mLRbH7wChVioNoC5QVw@mail.gmail.com>
- In-Reply-To
- <xmqqcy12l2ft.fsf@gitster.g>
On Tue, Mar 17, 2026 at 2:48 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> > Eric Sunshine <sunshine@sunshineco.com> writes: > > >> + test_when_finished "rm -f sample*-i patch patch-new target" && > >> + (test_write_lines 1 2 3 "" 4 5 ) >sample-i && > >> + (test_write_lines 1 2 3 "" 0 5 ) >sample2-i && > > > > Curious. Why are the `test_write_line` invocations wrapped in parentheses? > > > > Also, is the whitespace before the closing parenthesis intentional? > > > >> test_expect_success 'incomplete context line (not an error)' ' > >> (test_write_lines 1 2 3 4 5 && printf 6) >sample-i && > >> (test_write_lines 1 2 3 0 5 && printf 6) >sample2-i && > > > > Perhaps the parentheses in the new test were copied from some existing > > test, such as this, which already used them for a legitimate reason? > > Yes, the existing one was concatenating output from two commands run > in a row into a single redirection, so (grouping of the commands) in > parentheses were justifiable. > > The new one does not have such a justification. Thanks for > noticing.
I think braces { test_writes lines … && printf … ; } would have sufficed for the second example, and might be cheaper (avoiding the extra process for the subshell, which we've been told is especially expensive for Windows).
-- D. Ben Knoble