Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » GitServlet HowTo
GitServlet HowTo [message #1066515] Tue, 02 July 2013 22:06 Go to next message
Lukas Stampf is currently offline Lukas Stampf
Messages: 2
Registered: July 2013
Junior Member
Hello,

I am doing a java webapp which needs to react on git pushes. It doesnt have to do much, when a push happens it should call a service method with a list of changed files when the service returns true it should let the push through otherwise it should reject it.

Google says that this can be implemented with a pre-recieve hook and i found the GitServlet in org.eclipse.jgit.http.server. I managed to clone a repository from the Servlet but now I have a problem: I couldnt find any documentation for this package.

What kind of config does it take?
Do you have to extend it to configure it?
Are there any examples?

I dont really want to run a full gitblit and write a groovy hook since I dont need authentication, ...... I just need hooked pushes into one repo.
Re: GitServlet HowTo [message #1067787 is a reply to message #1066515] Wed, 10 July 2013 14:57 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias Sohn
Messages: 578
Registered: July 2009
Senior Member
Javadoc is available on Maven central [1]. Have a look at Gitblit and Gerrit implementation,
both are open source and use the GitServlet.

JGit doesn't support the hooks understood by native git.

[1] http://search.maven.org/#artifactdetails%7Corg.eclipse.jgit%7Corg.eclipse.jgit.http.server%7C3.0.0.201306101825-r%7Cjar
Re: GitServlet HowTo [message #1067993 is a reply to message #1067787] Thu, 11 July 2013 15:17 Go to previous message
Lukas Stampf is currently offline Lukas Stampf
Messages: 2
Registered: July 2013
Junior Member
Thank you for your reply.

I already found GitBlit and his util methods were really helpful.
I know have a running GitServlet and a PreRecieveHook. I only have one problem left.
In my hook, I need to parse the contents of some files being pushed. But the files only consist as packs in my repository. Is there an easy way to get the files pushed?
Or to unpack certain files?


EDIT:
I have found an acceptable solution.
I switched the server repo to non-bare and call a checkout on the new SHA Hash. I just have to cleanup in the PostRecieveHook. Works quite well.

[Updated on: Thu, 11 July 2013 17:07]

Report message to a moderator

Previous Topic:Merge + Squash does not change MERGE_HEAD?
Next Topic:Export-Function for changed Files
Goto Forum:
  


Current Time: Wed Sep 17 17:52:21 GMT 2014

Powered by FUDForum. Page generated in 0.02296 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software