git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4] diff: stop output garbled message in dry run mode

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 22, 2025, 19:53 UTC
Message-ID
<xmqqms5iyap5.fsf@gitster.g>
In-Reply-To
<20251019163024.18939-1-yldhome2d2@gmail.com>
Lidong Yan <yldhome2d2@gmail.com> writes:
Show 26 quoted lines
> +test_expect_success 'diff -I<regex>: ignore all content changes' '
> +	test_when_finished "git rm -f file1 file2 file3" &&
> +	: >file1 &&
> +	git add file1 &&
> +	: >file2 &&
> +	git add file2 &&
> +	: >file3 &&
> +	git add file3 &&
> +
> +	rm -f file1 file2 &&
> +	mkdir file2 &&
> +	echo "A" >file3 &&
> +	A_hash=$(git hash-object -w file3) &&
> +	echo "B" >file3 &&
> +	B_hash=$(git hash-object -w file3) &&
> +	cat <<-EOF | git update-index --index-info &&
> +	100644 $A_hash 1	file3
> +	100644 $B_hash 2	file3
> +	EOF
> +
> +	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?

Show 13 quoted lines
> +	} &&
> +	test_diff_no_content_changes "--raw" &&
> +	test_diff_no_content_changes "--name-only" &&
> +	test_diff_no_content_changes "--name-status" &&
> +
> +	: >actual &&
> +	test_must_fail git diff --quiet -I".*" >actual &&
> +	test_must_be_empty actual
> +'
> +
>  # check_prefix <patch> <src> <dst>
>  # check only lines with paths to avoid dependency on exact oid/contents
>  check_prefix () {
Previous: Lidong YanNext: Junio C Hamano
Message 18 of 21 in “diff: stop output garbled message in dry run mode”
  1. diff: stop output garbled message in dry run modeLidong Yan via GitGitGadget, Oct 17, 2025
  2. Johannes SchindelinOct 17, 2025
  3. Junio C HamanoOct 17, 2025
  4. Junio C HamanoOct 17, 2025
  5. Junio C HamanoOct 17, 2025
  6. Junio C HamanoOct 17, 2025
  7. Lidong YanOct 18, 2025
  8. Junio C HamanoOct 18, 2025
  9. Jeff KingOct 18, 2025
  10. Lidong YanOct 18, 2025
  11. Jeff KingOct 18, 2025
  12. Junio C HamanoOct 18, 2025
  13. Lidong YanOct 19, 2025
  14. Junio C HamanoOct 19, 2025
  15. diff: stop output garbled message in dry run modeLidong Yan, Oct 18, 2025
  16. diff: stop output garbled message in dry run modeLidong Yan, Oct 19, 2025
  17. diff: stop output garbled message in dry run modeLidong Yan, Oct 19, 2025
  18. Junio C HamanoOct 22, 2025
  19. Junio C HamanoOct 22, 2025
  20. Lidong YanOct 23, 2025
  21. Jeff KingOct 23, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.