{"thread":{"id":"30673","subject":"git-smart-http reject push","startedAt":"2012-05-31T20:38:38Z","lastAt":"2012-06-01T06:52:58Z","messageCount":4,"participants":["Tajti Ákos","Shawn Pearce","Sitaram Chamarty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"192621","messageId":"4FC7D6CE.30802@intland.com","threadId":"30673","inReplyTo":null,"subject":"git-smart-http reject push","fromName":"Tajti Ákos","fromEmail":"akos.tajti@intland.com","sentAt":"2012-05-31T20:38:38Z","receivedAt":"2012-05-31T20:38:38Z","isPatch":false,"sender":{"key":"akos.tajti@intland.com","avatar":null},"body":"Dear List,\n\nwe wrote a servlet that is basically a proxy for git-http-backend. We \nwant to control who can create a new branch. Is there a way to reject a \npush that would create a new branch (without using hooks)?\n\nThanks in advance,\nÁkos Tajti\n"},{"id":"192622","messageId":"CAJo=hJvH7YuCyNU9rGRQUQy3ccE+v3o99=MkX-k3dHGkTZA1nA@mail.gmail.com","threadId":"30673","inReplyTo":"4FC7D6CE.30802@intland.com","subject":"Re: git-smart-http reject push","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2012-05-31T20:52:23Z","receivedAt":"2012-05-31T20:52:23Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"On Thu, May 31, 2012 at 1:38 PM, Tajti Ákos <akos.tajti@intland.com> wrote:\n> we wrote a servlet that is basically a proxy for git-http-backend. We want\n> to control who can create a new branch. Is there a way to reject a push that\n> would create a new branch (without using hooks)?\n\nNot easily. Is the servlet in Java? You might want to consider just\nembedding JGit[1] and using that. JGit will let your servlet install\nan implementation of its PreReceiveHook interface where you can\ninspect the parsed protocol data, decide what to do, and reject it or\nallow it through.\n\nTo reject before it makes it to git-http-backend you need to parse the\nincoming data stream, decode the commands, and then forward the\nunparsed stream to git-http-backend. If you are in Java you might be\nable to reuse some of the JGit classes to help you parse the protocol.\nMaybe. Those classes weren't really built to be used on their own.\n\n[1] http://www.eclipse.org/jgit/\n"},{"id":"192628","messageId":"CAMK1S_iAxdTg04ctZMUKAyoBRGT=w8rp2dTMDFvmpW_McPP-hQ@mail.gmail.com","threadId":"30673","inReplyTo":"4FC7D6CE.30802@intland.com","subject":"Re: git-smart-http reject push","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2012-06-01T03:53:35Z","receivedAt":"2012-06-01T03:53:35Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Fri, Jun 1, 2012 at 2:08 AM, Tajti Ákos <akos.tajti@intland.com> wrote:\n> Dear List,\n>\n> we wrote a servlet that is basically a proxy for git-http-backend. We want\n> to control who can create a new branch. Is there a way to reject a push that\n> would create a new branch (without using hooks)?\n\nNot sure what else your servlet does or how it affects things but\ngitolite has controls to prevent branches being created (among many\nmany other things, limited mostly by ones imagination!).\n\nGitolite is normally used with ssh but it has been tested with smart\nhttp also.  It itself acts as a proxy for git-http-backend, inspecting\nthe URI and QUERY_STRING and such animals to decode some things, while\nthe rest happens via a special update hook that is installed in each\nrepo that it controls.\n\n(Specifically, the branch create check is done there, not in the part\nthat is proxying the git-http-backend process.  You probably know that\nthe update hook is invoked by git itself).\n\nSitaram\n"},{"id":"192630","messageId":"4FC866CA.1080203@intland.com","threadId":"30673","inReplyTo":"CAMK1S_iAxdTg04ctZMUKAyoBRGT=w8rp2dTMDFvmpW_McPP-hQ@mail.gmail.com","subject":"Re: git-smart-http reject push","fromName":"Tajti Ákos","fromEmail":"akos.tajti@intland.com","sentAt":"2012-06-01T06:52:58Z","receivedAt":"2012-06-01T06:52:58Z","isPatch":false,"sender":{"key":"akos.tajti@intland.com","avatar":null},"body":"Thanks for the answers!\n\nÁkos\n\n2012.06.01. 5:53 keltezéssel, Sitaram Chamarty írta:\n> On Fri, Jun 1, 2012 at 2:08 AM, Tajti Ákos<akos.tajti@intland.com>  wrote:\n>> Dear List,\n>>\n>> we wrote a servlet that is basically a proxy for git-http-backend. We want\n>> to control who can create a new branch. Is there a way to reject a push that\n>> would create a new branch (without using hooks)?\n> Not sure what else your servlet does or how it affects things but\n> gitolite has controls to prevent branches being created (among many\n> many other things, limited mostly by ones imagination!).\n>\n> Gitolite is normally used with ssh but it has been tested with smart\n> http also.  It itself acts as a proxy for git-http-backend, inspecting\n> the URI and QUERY_STRING and such animals to decode some things, while\n> the rest happens via a special update hook that is installed in each\n> repo that it controls.\n>\n> (Specifically, the branch create check is done there, not in the part\n> that is proxying the git-http-backend process.  You probably know that\n> the update hook is invoked by git itself).\n>\n> Sitaram\n"}]}