[Qt-creator] prepare-commit-msg and commit-msg hooks
Tobias Hunger
tobias.hunger at gmail.com
Tue Jan 9 10:43:09 CET 2018
Hi Seth!
You are almost correct AFAICT.
> - User types commit message into blank Description box
Actually GitClient::getCommitData retrieves the text for the commit
message that is shown in the description box. That can be blank or
some of the different templates used by git. Creator does not run any
hooks at that point though.
> - User presses "Commit"
... and creator runs "git commit", triggering all the magic git does
with the user-provided commit message as input.
Hooks do get run at this point, but it is admittedly a bit late for
the pre-commit or the prepare-commit-msg hook. Do you have any idea
how we can improve this -- without reimplementing all the logic built
into git?
Best Regards,
Tobias
On Mon, Jan 8, 2018 at 3:25 PM, Seth Raymond <seth.c.raymond at gmail.com> wrote:
> With the current Qt Creator git plugin implementation, it is difficult (and
> perhaps impossible?) to use the prepare-commit-msg and commit-msg hooks to
> check if a commit message is stylistically valid. This is because Qt Creator
> does not run `git commit` until after the message has been written in the
> "Description" box and the "Commit" button has been pressed. The current
> sequence is as follows:
>
> -User types commit message into blank Description box
> -User presses "Commit"
> -Description is written to temp/commit/msg
> -prepare-commit-msg hook is run on path/to/repo/.git/EDIT-COMMITMSG
> -Data from temp/commit/msg is pseudo-appended to
> path/to/repo/.git/EDIT-COMMITMSG
> -commit-msg hook is run on path/to/repo/.git/EDIT-COMMITMSG
>
> My temporary workaround is to use a static template, but the template cannot
> dynamically insert text into the commit (such as the current branch name). I
> could "fix" the commit message after the user is done, but that is not
> ideal. Suggestions?
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator
>
More information about the Qt-creator
mailing list