Skip to content

pr-git-1127/SamuelYvon/maint-v1

From: Samuel Yvon <samuelyvon9@gmail.com>

Changes made within a pre-commit hook are not reflected within
the editor (for instance, with `git commit --verbose`) because
the index is re-read after the editor has been used.

This has the consequence of not displaying the actual changes made
by the pre-commit hook, but committing them anyways.

While it is often argued that the hook's purpose is not to automatically
write content to the repository, it is acknowledged that using the
pre-commit to apply mechanical fixes on top of the existing changes
is a supported use case, along with verifying the content.

I think not seeing these mechanical fixes before commiting is incorrect.
A developer might expect the commit to look a certain way but if the
pre-commit goes wrong the invalid changes will go unnoticed until
committed.

Signed-off-by: Samuel Yvon <samuelyvon9@gmail.com>

Submitted-As: https://lore.kernel.org/git/pull.1127.git.git.1636423586620.gitgitgadget@gmail.com
Assets 2