From: Maxime Louet <maxime@saumon.io>
To: git@vger.kernel.org
Subject: Verbose commit message diff not showing changes from pre-commit hook
Date: Sat, 25 Jul 2020 16:47:19 +0200 [thread overview]
Message-ID: <CADv3qkGq3jA8iXsjhrqfsUX=gW+KOuLyeVgDzmku1tUpsMdvtw@mail.gmail.com> (raw)
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
next reply other threads:[~2020-07-25 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-25 14:47 Maxime Louet [this message]
2020-07-25 15:00 ` Verbose commit message diff not showing changes from pre-commit hook 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADv3qkGq3jA8iXsjhrqfsUX=gW+KOuLyeVgDzmku1tUpsMdvtw@mail.gmail.com' \
--to=maxime@saumon.io \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).