From: Junio C Hamano <gitster@pobox.com>
To: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
Cc: git@vger.kernel.org, peff@peff.net
Subject: Re: [PATCH v2] t3700: avoid hidden failures and use test_grep helper
Date: Mon, 02 Mar 2026 13:24:28 -0800 [thread overview]
Message-ID: <xmqqh5qxzzzn.fsf@gitster.g> (raw)
In-Reply-To: <20260228070020.89668-1-r.siddharth.shrimali@gmail.com> (Siddharth Shrimali's message of "Sat, 28 Feb 2026 12:30:20 +0530")
Siddharth Shrimali <r.siddharth.shrimali@gmail.com> writes:
> Replace pipelines involving git commands with temporary files to ensure
> that any crashes or unexpected exit codes from the git commands are
> properly caught by the test suite. A simple pipeline like
> 'git foo | grep bar' ignores the exit code of 'git', which can
> hide regressions.
>
> Additionally, replace standard 'grep' with the 'test_grep' helper.
> This improves debuggability by automatically dumping the contents of
> the 'actual' file when a match is not found. In cases where we were
> counting lines with 'wc -l' to ensure a pattern was absent,
> simplify to 'test_grep !'.
Counting the instances of these changes, there are too many hunks
that fall into this "Additionally" category to consider them "while
at it" changes. In other words, this would want to become two
patches, one to break pipelines to expose the exit status of Git
that is upstream of a pipeline, and the other to use test_grep where
the original used grep.
>
> Suggested-by: Junio C Hamano <gitster@pobox.com>
>
> Signed-off-by: Siddharth Shrimali <r.siddharth.shrimali@gmail.com>
The trailer block does not allow blanks inside it. Remove the blank
line.
> @@ -544,9 +544,11 @@ test_expect_success 'all statuses changed in folder if . is given' '
> touch x y z sub/a sub/dir/b &&
> git add -A &&
> git add --chmod=+x . &&
> - test $(git ls-files --stage >actual && grep ^100644 actual | wc -l) -eq 0 &&
> + git ls-files --stage >actual &&
> + test_grep ! "^100644" actual &&
> git add --chmod=-x . &&
> - test $(git ls-files --stage >actual && grep ^100755 actual | wc -l) -eq 0
> + git ls-files --stage >actual &&
> + test_grep ! "^100755" actual
> )
> '
>
> @@ -582,4 +584,4 @@ test_expect_success CASE_INSENSITIVE_FS 'path is case-insensitive' '
> git add "$downcased"
> '
>
> -test_done
> \ No newline at end of file
> +test_done
Wait. What tree state is this patch meant to apply? If you made a
botched change in an earlier attempt, your "v2" patch should *not*
be relative to the tree state _with_ that botched attempt. It
should instead be a change relative to somewhere stable in my tree,
pretending as if your "v1" (which introduced an incomplete line to
this file, among possibly other changes) never happened.
So, I'd suggest a two-patch series that is:
- refine your v1 to remove mistakes (like the "incomplete last
line"; there might have been others but I do not remember),
keeping your conversion to break pipelines, without changing
"grep" to "test_grep". Make it [PATCH v2 1/2].
- turn "grep" you touched in [PATCH v2 1/2] above to use
"test_grep" instead. In this patch, if the parts of the file you
did not touch in [PATCH v2 1/2] has only small number of similar
uses of "grep" that is better written with "test_grep", it is OK
to change them to use "test_grep" as a "while at it" change.
Thanks.
next prev parent reply other threads:[~2026-03-02 21:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 16:51 [PATCH] t3700: avoid suppressing git's exit code Siddharth Shrimali
2026-02-27 18:19 ` Junio C Hamano
2026-02-28 7:00 ` [PATCH v2] t3700: avoid hidden failures and use test_grep helper Siddharth Shrimali
2026-03-02 21:24 ` Junio C Hamano [this message]
2026-02-28 8:12 ` [PATCH] t3700: avoid suppressing git's exit code Johannes Sixt
2026-02-28 10:15 ` Siddharth Shrimali
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqh5qxzzzn.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--cc=r.siddharth.shrimali@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox