From: Junio C Hamano <gitster@pobox.com>
To: Lidong Yan <yldhome2d2@gmail.com>
Cc: gitgitgadget@gmail.com, git@vger.kernel.org,
Johannes.Schindelin@gmx.de, jake@zimmerman.io, peff@peff.net
Subject: Re: [PATCH v4] diff: stop output garbled message in dry run mode
Date: Wed, 22 Oct 2025 14:33:26 -0700 [thread overview]
Message-ID: <xmqqwm4mwrix.fsf@gitster.g> (raw)
In-Reply-To: <xmqqms5iyap5.fsf@gitster.g> (Junio C. Hamano's message of "Wed, 22 Oct 2025 12:53:58 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Lidong Yan <yldhome2d2@gmail.com> writes:
> ...
>> + test_diff_no_content_changes () {
>> + git diff $1 --ignore-blank-lines -I".*" >actual &&
>> + test_line_count = 3 actual &&
>> + test_grep "file1" actual &&
>> + test_grep "file2" actual &&
>> + test_grep "file3" actual &&
>
> I am puzzled by this part of the new test.
>
>> + test_grep ! "diff --git" actual
>
> The "test_grep !" is to make sure we do not leak the "patch" output
> run in diff_flush_patch_quietly(), which is understandable, but in
> the new world order that even raw, name-only, and name-status honor
> "diff-from-contents" since b55e6d36 (diff: ensure consistent diff
> behavior with ignore options, 2025-08-08), shouldn't we expect empty
> "actual" that does not say file1/file2/file3 in it?
>
>> + } &&
>> + test_diff_no_content_changes "--raw" &&
>> + test_diff_no_content_changes "--name-only" &&
>> + test_diff_no_content_changes "--name-status" &&
I think this was due to the lack of /dev/null redirect around the
other call site of diff_flush_patch_quietly(). I've rearranged
patches in this order:
* Peff's /dev/null redirect for --quiet (NO_OUTPUT) codepath around
diff_flush_patch_quietly();
* My /dev/null redirect for --raw/--name-only/--name-status
codepath around diff_flush_patch_quietly() on top of the above;
* This patch with tests on top of the above.
And that was when I noticed the above test that expects 3 output
lines was fishy.
I have the following patch on top of your patch that started this
thread to queue it in 'seen' and have tests pass for today's
integration result.
t/t4013-diff-various.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh
index d35695f5b0..c0a558da55 100755
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
@@ -683,11 +683,7 @@ test_expect_success 'diff -I<regex>: ignore all content changes' '
test_diff_no_content_changes () {
git diff $1 --ignore-blank-lines -I".*" >actual &&
- test_line_count = 3 actual &&
- test_grep "file1" actual &&
- test_grep "file2" actual &&
- test_grep "file3" actual &&
- test_grep ! "diff --git" actual
+ test_must_be_empty actual
} &&
test_diff_no_content_changes "--raw" &&
test_diff_no_content_changes "--name-only" &&
--
2.51.1-638-ge1c807bd82
next prev parent reply other threads:[~2025-10-22 21:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 3:17 [PATCH] diff: stop output garbled message in dry run mode Lidong Yan via GitGitGadget
2025-10-17 12:07 ` Johannes Schindelin
2025-10-17 19:15 ` Junio C Hamano
2025-10-17 20:19 ` Junio C Hamano
2025-10-17 20:17 ` Junio C Hamano
2025-10-17 16:17 ` Junio C Hamano
2025-10-18 1:11 ` Lidong Yan
2025-10-18 5:02 ` Junio C Hamano
2025-10-18 9:47 ` Jeff King
2025-10-18 9:50 ` Lidong Yan
2025-10-18 9:56 ` Jeff King
2025-10-18 15:44 ` Junio C Hamano
2025-10-19 14:31 ` Lidong Yan
2025-10-19 15:33 ` Junio C Hamano
2025-10-18 9:48 ` [PATCH v2] " Lidong Yan
2025-10-19 16:20 ` [PATCH v3] " Lidong Yan
2025-10-19 16:30 ` [PATCH v4] " Lidong Yan
2025-10-22 19:53 ` Junio C Hamano
2025-10-22 21:33 ` Junio C Hamano [this message]
2025-10-23 0:27 ` Lidong Yan
2025-10-23 12:30 ` Jeff King
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=xmqqwm4mwrix.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jake@zimmerman.io \
--cc=peff@peff.net \
--cc=yldhome2d2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.