New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git hooks are not firing when using gollum web interface #69
Comments
This is an omission of Grit::Index. It's basically an implementation of the Git commit process in ruby. In the meantime, someone can probably add hook support into Grit, or Rugged/libgit2 when that's ready. Gollum uses Grit now as its primary ruby library, but I hope to move it to Rugged someday. |
the place we write the commit in Grit does not handle local hooks yet. we may get to it, but if you want to help out it's right around line 140 in the Grit::Index file in the Grit project. code would have to be added around the 'update_ref' line to check for executable hooks and attempt to fire them. |
+1 |
Closing until grit gets support for this. |
+1 |
It's been 4 years since this ticket has been closed, and I'm sure rugged/libgit2 has evolved quite a bit during that time. I'm not a ruby guy, but any chance to reopen this item? |
Based on the discussion here, it looks like libgit2 doesn't support hooks yet (and will do so in the future only to the extent that the library will provide callbacks with info about local hooks). However, in the mean time, gollum has implemented it's own post-commit callbacks: see https://github.com/gollum/gollum-lib#api-documentation. Such gollum-specific hooks can be set in the optional |
@dometto — thanks for the detailed reply along with a solution! It looks like there's a very good reason for me to learn some basic Ruby then. |
@pejvan Did you get your hook working? I am hoping to implement a post-commit hook to push the repo to a remote master. |
Hi Derek. On 28 May 2015 at 15:55, Derek Kozel notifications@github.com wrote:
|
To get gollum to respect git hooks, in a Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
system('/path/to/wiki/.git/hooks/post-commit')
end This file then has to be specified using the |
@k00p Is this code specific to the used git adapter? Will this run both on grit and rugged? Also is there any way to debug this? Doesn't seem to get called in my case. Not a ruby developer. Can I just print to stdout to verify this snippet is being called? |
@pReya It has been a really long time since I was working with this, but I can tell you that I was working on synchronizing a GitLab based project wiki with a local Gollum instance running in a RedHat 6.5 environment. I no longer have access to that project, so I can’t really provide much more detail, I’m afraid. I do recall writing some instrumentation to confirm that it was running, so it should be possible to write to a log or a terminal. I wish I could help more. Best of luck to you. |
@pReya I can confirm that @k00p 's snippet still works on gollum
Yes, Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
puts "post commit hook called"
end |
@bartkamphorst Thanks! I got it working! Not sure what the problem was. Probably wrong path for the config file. |
Good to hear! |
In my wiki git repository, I created a post-commit hook which should push the commit changes to the remote server
Manual commits fire the hook, however commits when editing gollum interface do not seem to fire post-commit hook. Am I missing something and/or doing something outrageously odd way?
I'm new to both gollum and git, so please be patient to my ignorance.
The text was updated successfully, but these errors were encountered: