Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] how to enable hooks on a repo?

Hi

I'm writing some test that checks that the messages from the server are written to the outputstream, one would pass to the PushOperation (a patch I'm writing that allows push-messages to get written to the Eclipse console while the push is executed). In my test, I therefore try to install a hook on a repository that would produce some output when I push to this repository. Unfortunately my hook's not called and I wonder what I'm missing:

<snip>

        Repository repo = repository1.getRepository();
        ReceivePack receivePack = new ReceivePack(repo);
        receivePack.setPostReceiveHook(new PostReceiveHook() {

            public void onPostReceive(ReceivePack rp,
                    Collection<ReceiveCommand> commands) {
                    ...
            }
        });
        receivePack.setPreReceiveHook(new PreReceiveHook() {

            public void onPreReceive(ReceivePack rp,
                    Collection<ReceiveCommand> commands) {
                    ...
            }
        });
</snip>

I'd appreciate a lot if you could give me some pointers. Thanks!

Cheers
André


Back to the top