Git: Support prepare-commit-msg hook #94274
Labels
feature-request
Request for new features or functionality
git
GIT issues
help wanted
Issues identified as good community contribution opportunities
Milestone
In vscode, during a git commit, the
prepare-commit-msg
hook of git runs only after the message is already inputed by the user. It defeats the fact that this hook must prepare the message for the user.It means that the user can't benefit from the prepared message. For example, I have a hook which adds 10 lines of comments. Those comments contain some info that is helping me to write the final message. Ideally the prepare-commit-msg hook should run first, then the content created by the hook must go into the commit message input box, then the user can edit this text.
Apparently vscode is trying to commit by using an equivalent of
git commit -m "the message"
, at least that is what I understand from the2=message
in step 12.An additional note, it seems that if the message inputted by the user in vscode during a
Git: Commit
is# foo
(so starting with a#
), the hook doesn't run. That's... surprising?Steps to Reproduce:
.git/hook/prepare-commit-msg
with this contentchmod +x .git/hook/prepare-commit-msg
git commit --allow-empty
and do not close the editor yetrm /tmp/investigate-prepare-commit-msg
echo "creating a diff" > some_file && git add some_file && code .
Git: Commit
and do not input a message yetnote the
2=message
part13. check that the commit contains the same thing as /tmp/investigate-prepare-commit-msg
Does this issue occur when all extensions are disabled?: Yes
The text was updated successfully, but these errors were encountered: