git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Behavior of git log --diff-filter=d
@ 2025-07-02 20:28 Eric Salem
  2025-07-03 13:42 ` Re " K Jayatheerth
  2025-07-03 15:34 ` Jeff King
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Salem @ 2025-07-02 20:28 UTC (permalink / raw)
  To: git

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

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

end of thread, other threads:[~2025-07-07  5:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 20:28 Behavior of git log --diff-filter=d Eric Salem
2025-07-03 13:42 ` Re " 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

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).