You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This appears to be a regrettable side-effect of writing the trailer as part of the commit preparation (the prepare-commit-msg hook). Specifically with vim you can workaround it by doing :ca (exit nonzero), but I believe we should take further steps to address this.
Some half-baked ideas/thoughts:
Adding a comment during the commit preparation above the trailers with something like # delete these trailers if you want to write an empty commit message
Add a commit-msg hook that looks for commit messages that only have the Co-authored-by: trailers and exit 1 (this is the status code it currently aborts with for empty commit messages). Consider the implications of how this works with --no-verify which would skip this hook.
Move this logic from a prepare-commit-msg hook to a commit-msg hook. The former seems to be theoretically the better place for it to live, but perhaps the latter is better from a practical stand point. Not crazy about this idea.
Worst-case: document this new behavior in the README
I was initially confused that the Signed-off-by trailer didn't do the same thing, but it looks like git explicitly ignores these when looking for empty commit messages: https://github.com/git/git/blob/master/sequencer.c#L753-L789 . If only we could add some more to ignore.
I'll mark this as a bug since it is technically a regression in behavior.
If I run
git dci
withoutGIT_DUET_CO_AUTHORED_BY
set, and then run:qa
in vim. It will not commit.If I run
git commit/dci
withGIT_DUET_CO_AUTHORED_BY
set (andGIT_DUET_GLOBAL
set), and then run:qa
in vim, it will still make the commit either way.The text was updated successfully, but these errors were encountered: