Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] git hooks for [e|j]git


On Tue, Nov 4, 2014 at 12:38 PM, Laurent Goubet <laurent.goubet@xxxxxxx> wrote:
You've removed the list from the discussion, was that intended?

No, sorry, my mistake. I resent to the list.

Whatever we do, we need, at one point, to determine whether the hook exists in .git/hooks, and if it does, if it is executable. That's the one test needed, and I can't se a way to make it less so. In cgit, the test is done within run-command (see ). In java, you can see how I did it in the FS implementations, namely and (and the sub-par for Java 5... which couldn't even check if the file is executable afaik).

Some hooks can be disabled through an option: CommitCommand#noVerify bypasses the pre-commit and commit-msg hooks (mimics cgit's "--no-verify"), CommitCommand#noPostRewrite bypasses the post-rewrite hook (mimics cgit's "--no-post-rewrite"). "post-commit", "pre-rebase" and, only on rebase, "post-rewrite" cannot be bypassed... but we can introduce new options to do so even if they don't exist in cgit. I am unsure of the impact of the simple test "isExecutable" though...

I fully agree. There is no way that we can avoid a check for .git/hooks/*. No problem with that. But you have been reading .git/COMMIT_MSG before you checked that you'll really need that data. That's and extra open&read although there may be no hooks present.


Back to the top