From: Eric Sunshine Date: Fri, 31 Jan 2025 14:28:01 GMT Subject: Re: [PATCH v4 1/8] t5504: modernize test by moving heredocs into test bodies Message-ID: In-Reply-To: <20250131-pks-push-atomic-respect-exit-code-v4-1-a8b41f01a676@pks.im> On Fri, Jan 31, 2025 at 5:53 AM Patrick Steinhardt wrote: > We have several heredocs in t5504 located outside of any particular test > bodies. Move these into the test bodies to match our modern coding > style. > > Signed-off-by: Patrick Steinhardt > --- > diff --git a/t/t5504-fetch-receive-strict.sh b/t/t5504-fetch-receive-strict.sh > @@ -64,12 +64,6 @@ test_expect_success 'fetch with transfer.fsckobjects' ' > -cat >exp < -To dst > -! refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects) > -Done > -EOF > - > test_expect_success 'push without strict' ' > @@ -78,6 +72,11 @@ test_expect_success 'push without strict' ' > + cat >exp <<-EOF && > + To dst > + ! refs/heads/main:refs/heads/test [remote rejected] (missing necessary objects) > + Done > + EOF It's minor, but to make this conform to modern style even more, it would use `\EOF` rather than `EOF`. (Probably not worth a reroll on its own.) > @@ -94,11 +93,6 @@ test_expect_success 'push with !receive.fsckobjects' ' > -cat >exp < -To dst > -! refs/heads/main:refs/heads/test [remote rejected] (unpacker error) > -EOF > - > test_expect_success 'push with receive.fsckobjects' ' > @@ -107,6 +101,10 @@ test_expect_success 'push with receive.fsckobjects' ' > + cat >exp <<-EOF && > + To dst > + ! refs/heads/main:refs/heads/test [remote rejected] (unpacker error) > + EOF Ditto. > @@ -129,15 +127,14 @@ test_expect_success 'repair the "corrupt or missing" object' ' > -cat >bogus-commit < -tree $EMPTY_TREE > -author Bugs Bunny 1234567890 +0000 > -committer Bugs Bunny 1234567890 +0000 > - > -This commit object intentionally broken > -EOF > - > test_expect_success 'setup bogus commit' ' > + cat >bogus-commit <<-EOF && > + tree $EMPTY_TREE > + author Bugs Bunny 1234567890 +0000 > + committer Bugs Bunny 1234567890 +0000 > + > + This commit object intentionally broken > + EOF This one is correctly using `EOF` since it's interpolating variables.