git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-smart-http reject push

From
Shawn Pearce <spearce@spearce.org>
Date
May 31, 2012, 20:52 UTC
Message-ID
<CAJo=hJvH7YuCyNU9rGRQUQy3ccE+v3o99=MkX-k3dHGkTZA1nA@mail.gmail.com>
In-Reply-To
<4FC7D6CE.30802@intland.com>
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/
Previous: Tajti ÁkosNext: Sitaram Chamarty
Message 2 of 4 in “git-smart-http reject push”
  1. Tajti ÁkosMay 31, 2012
  2. Shawn PearceMay 31, 2012
  3. Sitaram ChamartyJun 1, 2012
  4. Tajti ÁkosJun 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.