kubitron / redmine_git_hosting

A ChiliProject/Redmine plugin which makes configuring your own git hosting easy.
78 stars 15 forks source link

Add execution of additional post-receive hooks #78

Open tomka opened 12 years ago

tomka commented 12 years ago

As this plugin occupies the post-receive hook of a managed repository, no other post-receive hook can be used. To get around this limitation, this commit changes the installed hook in such a way that it looks for additional executable files in a sub-directory of the repository's hook folder. This sub-directory has to be called "post-receive.d". The plugin's hook will execute all the files in there marked as executable and will provide the processes with the same STDIN stream it got when called in the first place.

frasten commented 12 years ago

I'd love to see this feature merged. Current Post-Receive URLs add some complexity to my workflow (a webpage is run as the webserver user, but I'd like to be executed by the gitolite user, so I had to add a workaround...).

kubitron commented 12 years ago

Why does the readme explicitly talk about putting hooks into the individual hooks directory of a repository? Wouldn't it make more sense to put them into the top-level .gitolite/hooks/post-receive.d directory? If I understand gitolite, this directory would then be linked into all new repositories...? Alternatively, perhaps it would make sense to support both global and local configuration with two different directory names..?

tomka commented 12 years ago

Supporting both, global and local extra hooks, sounds reasonable. As I only needed local configurations in the first place, I only came up with this addition. So that is why the readme talks only about individual hook directories. Also, I guess per-repo hooks are pretty common. However, I'll add support for global configurations in the next days to this pull request. I propose to have the directory "post-receive.d" for global hooks (linked automatically for new repos) and "post-reseive.local.d" for individual per-repo hooks.

tomka commented 12 years ago

The latest commit adds support for local and global hooks. The commit message states the details. What do you think about it?

kubitron commented 12 years ago

Hello. Thank you for your work. Sorry for the delay.

I have a couple of folks with hook problems at the moment, so I am going to wait until that is resolved... I may put this into version 0.5.2x.

tomka commented 12 years ago

Hi kubitron, thanks for getting back to this and considering it for a merge. I thought about adding the presentation of all available executable hooks in a projects repository settings (and maybe of the global hooks in the plugin's global settings). What's your opinion on this?

tomka commented 11 years ago

I just rebased this code to the most recent master branch (fba1f7e8e5).