login
Header Space

 
 

Re: multiple files for the same hook

Previous thread: [JGIT PATCH v2 0/24] Implementation of a file tree iteration using ignore rules. by Florian Koeberle on Monday, May 12, 2008 - 4:13 pm. (46 messages)

Next thread: [PATCH] Documentation: rev-parse: add a few "--verify" and "--default" examples by Christian Couder on Tuesday, May 13, 2008 - 12:51 am. (1 message)
To: <git@...>
Date: Monday, May 12, 2008 - 4:39 pm

Hi,

we use hooks a lot for various cleanup tasks, tests and warnings. It 
would be wonderful if we could keep the hook logic in separate files. 

Something like

    hooks/post-commit.d/

where all executable files in the dir are executed in alphanumeric 
order. Is there a possibility of this going into git (I could try a 
patch)?

Tom
--
To: Thomas Hunger <hto@...>
Cc: <git@...>
Date: Monday, May 12, 2008 - 4:44 pm

On Mon, May 12, 2008 at 08:39:49PM +0000, Thomas Hunger &lt;hto@arcor.de&gt; wrot=

why would you want so? just create a script named hooks/post-commit,
like:

----
#!/bin/sh
/path/to/first/script
/path/to/second/script
----

or so.

it's not something git should do for you.
To: <git@...>
Date: Monday, May 12, 2008 - 5:56 pm

you are right, it's what we actually do, using --template to set up 
our own scripts. If nobody but us needs this it's certainly not worth 
bothering.

Thanks
Tom
--
To: Thomas Hunger <hto@...>
Cc: <git@...>
Date: Tuesday, May 13, 2008 - 12:21 am

The problem is that the semantics of calling some of the hooks is not as
simple as just calling them all in a row. How do you split up the input
going to the hooks? How do you combine the output coming from the hooks?
What is the resulting exit code? If one hook fails, do we indicate
failure? Or if one hook succeeds, do we indicate success?

So before any such code could go into git proper, there would have to be
agreement on how those issues are resolved. In the meantime, it probably
makes more sense to implement a "master" post-commit hook that uses the
semantics that you find useful.

-Peff
--
To: Jeff King <peff@...>
Cc: Thomas Hunger <hto@...>, <git@...>
Date: Tuesday, May 13, 2008 - 4:05 am

And when you are implementing those semantics, you might be able to

cheers,



m
--
 martin.langhoff@gmail.com
 martin@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
--
To: <hto@...>
Cc: <git@...>
Date: Monday, May 12, 2008 - 4:43 pm

Heya,

Wouldn't it be easy to have the hook script do that?
Just have it walk through the directory and call all the scripts?

-- 
Cheers,

Sverre Rabbelier
--
Previous thread: [JGIT PATCH v2 0/24] Implementation of a file tree iteration using ignore rules. by Florian Koeberle on Monday, May 12, 2008 - 4:13 pm. (46 messages)

Next thread: [PATCH] Documentation: rev-parse: add a few "--verify" and "--default" examples by Christian Couder on Tuesday, May 13, 2008 - 12:51 am. (1 message)
speck-geostationary