git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Verbose commit message diff not showing changes from pre-commit hook
@ 2020-07-25 14:47 Maxime Louet
  2020-07-25 15:00 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Louet @ 2020-07-25 14:47 UTC (permalink / raw)
  To: git

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

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

end of thread, other threads:[~2020-07-27 18:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25 14:47 Verbose commit message diff not showing changes from pre-commit hook Maxime Louet
2020-07-25 15:00 ` Junio C Hamano
2020-07-25 15:31   ` Junio C Hamano
2020-07-26 17:41     ` René Scharfe
2020-07-26 19:45       ` Maxime Louet
2020-07-27 18:13       ` Paolo Bonzini

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).