[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git
Subject:    Re: git-smart-http reject push
From:       Shawn Pearce <spearce () spearce ! org>
Date:       2012-05-31 20:52:23
Message-ID: CAJo=hJvH7YuCyNU9rGRQUQy3ccE+v3o99=MkX-k3dHGkTZA1nA () mail ! gmail ! com
[Download RAW message or body]

On Thu, May 31, 2012 at 1:38 PM, Tajti Ákos <akos.tajti@intland.com> wrote:
> we wrote a servlet that is basically a proxy for git-http-backend. We want
> to control who can create a new branch. Is there a way to reject a push that
> would create a new branch (without using hooks)?

Not easily. Is the servlet in Java? You might want to consider just
embedding JGit[1] and using that. JGit will let your servlet install
an implementation of its PreReceiveHook interface where you can
inspect the parsed protocol data, decide what to do, and reject it or
allow it through.

To reject before it makes it to git-http-backend you need to parse the
incoming data stream, decode the commands, and then forward the
unparsed stream to git-http-backend. If you are in Java you might be
able to reuse some of the JGit classes to help you parse the protocol.
Maybe. Those classes weren't really built to be used on their own.

[1] http://www.eclipse.org/jgit/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic