Verbose commit message diff not showing changes from pre-commit hook
- From
- Maxime Louet <maxime@saumon.io>
- Date
- Jul 25, 2020, 14:47 UTC
- Message-ID
- <CADv3qkGq3jA8iXsjhrqfsUX=gW+KOuLyeVgDzmku1tUpsMdvtw@mail.gmail.com>
Hi,
I'm using git version 2.27.0 on Linux.
I have verbose commits enabled (`git commit --verbose`) and a repository configured to lint code before every commit with a pre-commit hook. This hook may change files and `git add` them just before the commit.
However, when that hook actually changes files (and `git add`s them right away) these changes are not reflected in the commit verbose diff (the commented lines below the commit message). The changes *are* taken into account by git, as `git diff --staged` shows — and later the commit info, after actually making the commit. However the displayed diff in the commit message file is a snapshot of the diff *before* the pre-commit hook.
Is this expected behaviour? I find it somehow confusing that the diff in the commit message isn't the actual commit diff.
Thank you for your help!
Kind regards,
-- Maxime Louet