git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regression in `git diff --quiet HEAD` when a new file is staged
@ 2025-10-17  0:09 Jake Zimmerman
  2025-10-17  7:51 ` Jeff King
  0 siblings, 1 reply; 27+ messages in thread
From: Jake Zimmerman @ 2025-10-17  0:09 UTC (permalink / raw)
  To: git

In git v2.51.1, `git diff --quiet HEAD` will actually print something
if the diff output includes a new, staged file.

## To reproduce

    ❯ mkdir foo
    ❯ cd foo
    ❯ git init .
    Initialized empty Git repository in /Users/jez/foo/.git/
    ❯ gc --allow-empty -m "Initial empty commit"
    [master (root-commit) 858966f] Initial empty commit
    ❯ touch foo.txt
    ❯ git add foo.txt
    ❯ git diff --quiet HEAD

On git v2.51.0, the output of the last command is empty.
On git v2.51.1, the output of the last command is this:

    diff --git a/foo.txt b/foo.txt
    new file mode 100644
    index 0000000..e69de29

## Expected behavior

The stated docs for `--quiet`: "Disable all output of the program," so
I expect there to be no output, like in older versions.

## Likely cause

I ran a git bisect and isolated this commit:

b55e6d36ebce69136559add8fffd1a65df231518
( https://github.com/git/git/commit/e1d3d61a45bfdc5031d2066c0e4505ebd8145777 )

"diff: ensure consistent diff behavior with ignore options"

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2025-10-23 13:42 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17  0:09 Regression in `git diff --quiet HEAD` when a new file is staged Jake Zimmerman
2025-10-17  7:51 ` Jeff King
2025-10-17  8:36   ` [PATCH] diff: restore redirection to /dev/null for diff_from_contents Jeff King
2025-10-17 18:22     ` Junio C Hamano
2025-10-19 21:09     ` Johannes Schindelin
2025-10-21  7:52       ` Jeff King
2025-10-17 11:44   ` Regression in `git diff --quiet HEAD` when a new file is staged Johannes Schindelin
2025-10-17 17:45   ` Junio C Hamano
2025-10-18  1:04     ` Lidong Yan
2025-10-18  9:42       ` Jeff King
2025-10-18  9:40     ` Jeff King
2025-10-18 15:23       ` Junio C Hamano
2025-10-21  7:36         ` Jeff King
2025-10-21 14:38           ` Junio C Hamano
2025-10-22  4:46             ` Lidong Yan
2025-10-22  9:14               ` Jeff King
2025-10-22 14:20                 ` Lidong Yan
2025-10-22 14:31               ` Junio C Hamano
2025-10-22 16:28                 ` Junio C Hamano
2025-10-22  9:11             ` Jeff King
2025-10-22 16:48               ` Junio C Hamano
2025-10-23 12:01                 ` Jeff King
2025-10-23 12:15                   ` Jeff King
2025-10-23 13:35                   ` Junio C Hamano
2025-10-22 17:39             ` Junio C Hamano
2025-10-23  0:33               ` Lidong Yan
2025-10-23 13:42                 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).