git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Salem <ericsalem@gmail.com>
To: git@vger.kernel.org
Subject: Behavior of git log --diff-filter=d
Date: Wed, 2 Jul 2025 15:28:43 -0500	[thread overview]
Message-ID: <64308d3f-281b-49a3-bc10-57878903bf4c@gmail.com> (raw)

Hi all. What am I doing wrong here?

The git log --diff-filter documentation[1] for deleted files says:

> Select only files that are Added (A), Copied (C), Deleted (D)...

> Also, these upper-case letters can be downcased to exclude.
> E.g. --diff-filter=ad excludes added and deleted paths.

A simple test:

$ cd $(mktemp -d)
$ git init
Initialized empty Git repository in /tmp/tmp.xnvNav956B/.git/
$ echo test1 > file1.txt
$ git add file1.txt 
$ git commit -m "first"
[master (root-commit) 71288dd00aff] first
 1 file changed, 1 insertion(+)
 create mode 100644 file1.txt
$ git rm file1.txt 
rm 'file1.txt'
$ git commit -m "second"
[master 6ff8f522b744] second
 1 file changed, 1 deletion(-)
 delete mode 100644 file1.txt
$ echo test2 > file2.txt
$ git add file2.txt 
$ git commit -m "third"
[master 41498d26ea5e] third
 1 file changed, 1 insertion(+)
 create mode 100644 file2.txt
$ git log --format="%H"
41498d26ea5ee6820834aa51351e1e7ce6ce8733
6ff8f522b744dfbc7c2201c5bf77cf5acc3028ce
71288dd00afff60f3a6576f93930aeb0130e5cd1
$ git log --format="%H" --diff-filter=D
6ff8f522b744dfbc7c2201c5bf77cf5acc3028ce
$ git log --format="%H" --diff-filter=d
$ git log --format="%H" --diff-filter=d --stat
41498d26ea5ee6820834aa51351e1e7ce6ce8733

 file2.txt | 1 +
 1 file changed, 1 insertion(+)
71288dd00afff60f3a6576f93930aeb0130e5cd1

 file1.txt | 1 +
 1 file changed, 1 insertion(+)
$ git version
git version 2.50.0

--diff-filter=D behaves as expected, but when using "d" instead, I don't
get any output unless I add another option (such as --stat or
--name-only).

Is this expected behavior?

Thanks,

Eric

[1] https://git-scm.com/docs/git-log#Documentation/git-log.txt---diff-filterACDMRTUXB

             reply	other threads:[~2025-07-02 20:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 20:28 Eric Salem [this message]
2025-07-03 13:42 ` Re Behavior of git log --diff-filter=d K Jayatheerth
2025-07-03 15:36   ` Jeff King
2025-07-03 21:30   ` Eric Salem
2025-07-03 15:34 ` Jeff King
2025-07-03 22:44   ` [PATCH] setup_revisions(): turn on diffs for all-negative diff filter Jeff King
2025-07-03 23:42     ` Eric Salem
2025-07-04 13:30     ` Karthik Nayak
2025-07-07  5:31     ` Junio C Hamano

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=64308d3f-281b-49a3-bc10-57878903bf4c@gmail.com \
    --to=ericsalem@gmail.com \
    --cc=git@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).