githook-maven-plugin icon indicating copy to clipboard operation
githook-maven-plugin copied to clipboard

Multiple named git-hooks of same type?

Open dwightmulcahy opened this issue 6 years ago • 2 comments

so if you do this:

<configuration>
      <hooks>
	   <pre-commit>Franklin Barbecue</pre-commit>
	   <pre-commit>Uncle Billy's Brewery</pre-commit>
      </hooks> ...

.git/hooks/pre-commit will contain: Uncle Billy's Brewery

not sure if it should push an error on the second one or do a chaining like described in #7

dwightmulcahy avatar Feb 09 '19 21:02 dwightmulcahy

The use case I can think of here is having a hook in a parent pom, and then another hook in a child pom, when the parent and child are not located together (like a bunch of disparate projects inheriting from a common base):

parent
   |__> pom.xml
child
    |___> pom.xml 

Where parent/pom.xml contains:

<configuration>
      <hooks>
	   <pre-commit>Parent check</pre-commit>
      </hooks> ...
</configuration>

and child/pom.xml contains:

<parent>
    <groupId>com.somecompany</groupId>
    <artifactId>parent</artifactId>
</parent>
...
<configuration>
      <hooks>
	   <pre-commit>Child additional check</pre-commit>
      </hooks> ...
</configuration>
...

@dwightmulcahy Is there another case you were thinking of? That one by itself would be pretty nice to support.

phillipuniverse avatar Feb 09 '19 22:02 phillipuniverse

Yeah, I see that situation being solved by the chaining solution ( #7 ). I'll have to think a little about this but I see the order of the pom's (maven reactor) determining the order if the current pom.xml inserts it's git-hook to the front. This would make sure that the parent project trumps (gets executed first) all...

i.e.

Parent check
Child additional check1
Child additional check2
...

dwightmulcahy avatar Feb 10 '19 05:02 dwightmulcahy