git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Possible git-diff bug when using exit-code with diff filters
@ 2024-04-20  1:13 German Lashevich
  2024-04-21 10:42 ` René Scharfe
  0 siblings, 1 reply; 32+ messages in thread
From: German Lashevich @ 2024-04-20  1:13 UTC (permalink / raw)
  To: git

> What did you do before the bug happened? (Steps to reproduce your issue)

I configured a diff filter via gitattributes to use a custom script that,
sometimes, can change the files being compared in a way that there are no
differences between them.
Then I used `git diff --exit-code` on the changed file.

> What did you expect to happen? (Expected behavior)

I expected `git diff --exit-code` to return 0, since there are no differences
between the files after the filter is applied.

> What happened instead? (Actual behavior)

`git diff --exit-code` correctly produces no output, but returns 1.

> What's different between what you expected and what actually happened?

The difference is that `git diff --exit-code`, instead of returning 0, returns
1 even when there is no output.

> Anything else you want to add:

I have prepared a repository with a test case that reproduces the issue.
You can find it at https://github.com/Zebradil/git-diff-exit-code-bug-repro
The Readme file in the repository contains instructions on how to reproduce
the issue.

[System Info]
git version: 2.44.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 6.8.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 17 Apr 2024
15:20:28 +0000 x86_64
compiler info: gnuc: 13.2
libc info: glibc: 2.39
$SHELL (typically, interactive shell): /bin/zsh

Best regards,
German Lashevich

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

end of thread, other threads:[~2024-06-10 16:33 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-20  1:13 Possible git-diff bug when using exit-code with diff filters German Lashevich
2024-04-21 10:42 ` René Scharfe
2024-04-21 18:17   ` Junio C Hamano
2024-04-21 18:32     ` rsbecker
2024-04-21 19:09       ` Junio C Hamano
2024-04-21 20:18         ` rsbecker
2024-05-05 10:19     ` René Scharfe
2024-05-06 17:22       ` Junio C Hamano
2024-05-05 10:19   ` [PATCH 1/2] diff: report unmerged paths as changes in run_diff_cmd() René Scharfe
2024-05-05 10:20   ` [PATCH 2/2] diff: fix --exit-code with external diff René Scharfe
2024-05-05 15:25     ` Phillip Wood
2024-05-06 17:31       ` Junio C Hamano
2024-05-06 18:23       ` René Scharfe
2024-05-08 15:25         ` phillip.wood123
2024-05-11 20:32           ` René Scharfe
2024-05-12  9:38             ` René Scharfe
2024-06-05  8:31     ` [PATCH v2 0/3] " René Scharfe
2024-06-05  8:35       ` [PATCH v2 1/3] t4020: test exit code with external diffs René Scharfe
2024-06-05  8:36       ` [PATCH v2 2/3] userdiff: add and use struct external_diff René Scharfe
2024-06-05  8:38       ` [PATCH v2 3/3] diff: let external diffs report that changes are uninteresting René Scharfe
2024-06-06  6:39         ` Johannes Sixt
2024-06-06  8:28           ` René Scharfe
2024-06-06 15:49             ` Junio C Hamano
2024-06-06  9:48         ` Phillip Wood
2024-06-07  8:19           ` René Scharfe
2024-06-05 16:47       ` [PATCH v2 0/3] diff: fix --exit-code with external diff Junio C Hamano
2024-06-09  7:35     ` [PATCH v3 " René Scharfe
2024-06-09  7:38       ` [PATCH v3 1/3] t4020: test exit code with external diffs René Scharfe
2024-06-10 16:33         ` Junio C Hamano
2024-06-09  7:39       ` [PATCH v3 2/3] userdiff: add and use struct external_diff René Scharfe
2024-06-09  7:41       ` [PATCH v3 3/3] diff: let external diffs report that changes are uninteresting René Scharfe
2024-06-10 13:48       ` [PATCH v3 0/3] diff: fix --exit-code with external diff phillip.wood123

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