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

Re: denying branch creation in a shared repository

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 19, 2009, 12:00 UTC
Message-ID
<alpine.DEB.1.00.0910191353080.4985@pacific.mpi-cbg.de>
In-Reply-To
<26ae428a0910190308t3233debdjfc0c8beedb9c0ac6@mail.gmail.com>
Hi,

first, if you want to be taken seriously, you might want to avoid to top-post.

Second, do diligent research (e.g. on the 'mob' user).
On Mon, 19 Oct 2009, Howard Miller wrote:
> I'm quite interested in this too but I can't see what that patch does at 
> all. I'm unsure what the 'mob' account is but a search suggests it's 
> something to do with anonymous access, which doesn't seem to make any 
> sense.

If this trivial script (_not_ a patch! This should be obvious at first sight) does not make any sense to you, I fear you will not be able to use hooks to do what you want to do.

> Can you explain?
Yes.

The 'mob' user (who is password-less) can push to the 'mob' branch _iff_ that exists. IOW a user of repo.or.cz can decide to let random people to push commits by creating the 'mob' branch and adding the 'mob' user to the pushers.

The first part of the hook (as you can see from the pretty helpful error messages it outputs) is about denying to push to anything but the mob branch.

The second part is much more interesting in the context of this thread (and I would expect anyone capable of reading shell scripts to see that readily), because it denies the 'mob' user to _create_ the 'mob' branch. See line 16ff.

So the point is: the update hook gets a "$2" = 0000... in case a branch is about to be created, and the hook can prevent that by exiting with a non-zero exit code.

Hth, Dscho

Previous: Howard MillerNext: Howard Miller
Message 8 of 12 in “denying branch creation in a shared repository”
  1. Mohit AronOct 19, 2009
  2. Sitaram ChamartyOct 19, 2009
  3. Mohit AronOct 19, 2009
  4. Sitaram ChamartyOct 20, 2009
  5. Björn SteinbrinkOct 19, 2009
  6. Johannes SchindelinOct 19, 2009
  7. Howard MillerOct 19, 2009
  8. Johannes SchindelinOct 19, 2009
  9. Howard MillerOct 19, 2009
  10. Howard MillerOct 19, 2009
  11. Thomas RastOct 19, 2009
  12. Howard MillerOct 19, 2009

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.