[Qt-creator] prepare-commit-msg and commit-msg hooks

Oswald Buddenhagen oswald.buddenhagen at qt.io
Tue Jan 9 13:05:32 CET 2018


On Tue, Jan 09, 2018 at 01:19:33PM +0200, Orgad Shaneh wrote:
>    What if there are no staged files? git commit will not execute any hook on
>    this case,
>
it can be forced with --allow-empty.

>    and this is the typical state when the Git Commit dialog is opened.
> 
well, yes, and the hook's output can depend on what has been staged.
so this is really an inherent problem of the fact that the dialog
parallelizes a workflow that is meant to be sequential. git gui has the
same problem, and it's even worse at dealing with it.

as a workaround, i can imagine canceling and re-starting the commit
whenever the index changes (after a small delay). if the generated
commit message differs but the user has already edited it, a warning is
shown (maybe make an exception for the gerrit change-id, otherwise it
gets annoying; preferentially, the latest generated id should be used to
minimize the risk of collisions).



More information about the Qt-creator mailing list