twmr / gerrit.el

gerrit integration in emacs
44 stars 5 forks source link

Automatically install commit-msg hook #16

Open twmr opened 3 years ago

twmr commented 3 years ago

It happened to me already several times that I wanted to upload a commit (or commits) to gerrit in a repo that doesn't have the gerrit commit-msg hook, which is responsible for adding the ChangeId line to the commit-msg.

In a recent commit I've added support for checking if the commit contains a change-id line before the gerrit-upload transient is shown. This avoids that you have to re-enter the gerrit-upload transient settings (assignee, topic, ..) after realizing that gerrit didn't accept the new commit due to a missing change-id line.

It would be nice if we could instead add a hook to git-commit-mode that checks if the upstream is a repo on a gerrit server downloads the commit-msg hook if it does not yet exist for the current repo.