tommarshall / git-good-commit

Git hook to help you write good commit messages, with no external dependencies.
MIT License
193 stars 33 forks source link

incompatible with git-review hooks #19

Open ssbarnea opened 7 years ago

ssbarnea commented 7 years ago

It seems that is not possible to use git-good-commit alongside git-review (gerrit) because both are installing the same hook: commit-msg.

We need to find a working solution for this so we can use both and eventually with other hooks.

I already made a CR for gerrit itself for adding this kind of functionality: https://gerrit-review.googlesource.com/#/c/103362/

The same code could be added to git-review-hook in order to enable call of other hooks. The first hooks that gets installed is supposed to create the commit-msg.d folder and next hooks will be able to deploy themselves into this folder.

ssbarnea commented 7 years ago

Here is the related bug raise for Gerrit: https://bugs.chromium.org/p/gerrit/issues/detail?id=5999

tommarshall commented 7 years ago

Hi @ssbarnea,

As described on the #20:

Multiple hooks (chaining) has unfortunately been a long running challenge with Git.

I appreciate the users of git-good-commit may run into this issue, however I think that resolving it is out of scope for any single commit hook, this project included. There's no agreed standard, so if every hook tried to offer it's own solution for chaining hooks they'd likely end up conflicting.

Rather than implement a solution within the hook itself I'd prefer to link to documentation so that users that require the hook chaining can solve this issue for themselves, e.g. http://stackoverflow.com/a/8734391

So I think this issue is worth addressing, but I think the solution needs to come in the way of documentation rather than the implementation of a concrete solution in the project itself.

Tom

ssbarnea commented 7 years ago

I am aware about that SO DYI workaround but it doesn't scale at all. My current working set of git repos is about ~100-150 repos.

As you observed I opened a CR on Gerrit itself for implementing this multi-hooks support and they were happy about the implementation. The change was not merged yet because we had some problems with test execution but we will get it sorted in the end.

Once we have this merged, Gerrit hook will be the first hook that implement it but also the most common hook in the wild.

After this you will be able to replicate the same functionality in your hook.