Possible git-diff bug when using exit-code with diff filters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux