Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.
What did you do before the bug happened? (Steps to reproduce your issue)
> bash
⬢[jreed@toolbox example-project]$ git diff-files --exit-code --patch; echo $? 0 ⬢[jreed@toolbox example-project]$ chmod g+w README.md ⬢[jreed@toolbox example-project]$ git diff-files --exit-code --patch; echo $? 1 ⬢[jreed@toolbox example-project]$ git diff --exit-code --patch; echo $? 0 ⬢[jreed@toolbox example-project]$ git diff-files --exit-code --patch; echo $? 0
What did you expect to happen? (Expected behavior)
Git diff-files should likely ignore group permissions changes, or at least its output should be stable across the same worktree/index state.
What happened instead? (Actual behavior)
The command `git diff-files --exit-code --patch` fails with no exit code when a file mode has changed in a way that the rest of git commands ignored. Furthermore, subsequent git commands seem to change the behavior of `git diff-files` in this regard, so it's hard to tell what is the expected behavior.
What's different between what you expected and what actually happened?
The `git diff-files --exit-code` command is inconsistent in how it behaves. I suspect it should ignore irrelavant mode changes like `g+w`, but even if it should report them, they should produce a patch or at least have stable results when we re-run the command.
Anything else you want to add:
Please review the rest of the bug report below. You can delete any lines you don't wish to share.
[System Info] git version: git version 2.41.0 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 6.5.10-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 2 19:59:55 UTC 2023 x86_64 compiler info: gnuc: 13.1 libc info: glibc: 2.37 $SHELL (typically, interactive shell): /usr/bin/fish
[Enabled Hooks] pre-commit pre-push