Re: [GSoC PATCH 07/16] t4153: avoid suppressing git's exit code
- From
Tian Yuchen <a3205153416@gmail.com>
- Date
- Mar 29, 2026, 15:59 UTC
- Message-ID
- <3575e53a-a675-4e55-bc17-cce9cff1423f@gmail.com>
- In-Reply-To
- <20260328200255.247759-8-vikingtc4@gmail.com>
On 3/29/26 04:02, Trieu Huynh wrote:
Show 21 quoted lines
> Update t4153-am-resume-override-opts.sh to redirect git-cmds > output to a temporary file instead of piping it directly to > not hide the exit code of git commands behind pipes, as a crash > in git might go unnoticed. > > Signed-off-by: Trieu Huynh <vikingtc4@gmail.com> > --- > t/t4153-am-resume-override-opts.sh | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh > index 9bec989a0e..30137aec20 100755 > --- a/t/t4153-am-resume-override-opts.sh > +++ b/t/t4153-am-resume-override-opts.sh > @@ -81,7 +81,8 @@ test_expect_success '--signoff overrides --no-signoff' ' > > # Applied side1 will be signed off > echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected && > - git cat-file commit HEAD^ | grep "Signed-off-by:" >actual && > + git cat-file commit HEAD^ >commit_raw && > + test_grep "Signed-off-by:" commit_raw >actual &&
The behavior of 'test_grep' is the opposite of what you might expect. It does nothing when the input matches, and only reports an error when it doesn't match. Therefore, 'actual' is empty here...
> test_cmp expected actual && > > # Applied side2 will not be signed off
...and this test is bound to fail.
Regards, Yuchen