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

Re: thoughts on a possible "pre-upload" hook

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 22, 2009, 16:05 UTC
Message-ID
<vpqd45jvub6.fsf@bauges.imag.fr>
In-Reply-To
<867hvr2cms.fsf@blue.stonehenge.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 13 quoted lines
>>>>>> "Sitaram" == Sitaram Chamarty <sitaramc@gmail.com> writes:
>
> Sitaram> Hello,
> Sitaram> As git is used more and more in corporate-type environments, at some
> Sitaram> point it becomes convenient to have *branches* (or more accurately,
> Sitaram> refs) that are not readable.  The simplest way to do this (from git's
> Sitaram> point of view) is to allow a "pre-upload" hook, rather like the
> Sitaram> "pre-receive" hook or "update" hook.
>
> It would seem that you would need to do this even before the commit.  So
> you're looking for the pre-commit hook.  Otherwise, the commit is invalid,
> because it doesn't accurately represent everything it references.  And the
> commit is the unit of transfer between repos.

I don't get the point. The OP's question is not about commiting, but about preventing a branch from being fetched. So, right before sending the commits in a branch, the server would execute a hook, and fail if it's not allowed.

But that alone would make it rather painfull for the user : "git clone" would fail if any branch in the repository is not readable, for example.

Also, don't forget that branches are just references, which means that if you prevent reference A from being uploaded, then another reference B may point to the same commits as A, and then you can bypass the safety hook on A by using B.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Randal L. SchwartzNext: Shawn O. Pearce
Message 3 of 9 in “thoughts on a possible "pre-upload" hook”
  1. Sitaram ChamartySep 22, 2009
  2. Randal L. SchwartzSep 22, 2009
  3. Matthieu MoySep 22, 2009
  4. Shawn O. PearceSep 22, 2009
  5. Sitaram ChamartySep 25, 2009
  6. Matthieu MoySep 25, 2009
  7. Sitaram ChamartySep 25, 2009
  8. Adam BrewsterSep 28, 2009
  9. Sitaram ChamartySep 28, 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.