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

Re: Adding more namespace support to git

From
Richard <richard.maw@gmail.com>
Date
Aug 21, 2016, 11:30 UTC
Message-ID
<CAB2VqoZdj1rhdt-4gUhXTAMQjJTOqCuwXiO6yfB2Fzyy_qSWHg@mail.gmail.com>
In-Reply-To
<20160821020537.eiyh4vnhmnuctgtz@x>
On 21 August 2016 at 03:05, Josh Triplett <josh@joshtriplett.org> wrote:
Show 16 quoted lines
> On Sat, Aug 20, 2016 at 08:07:00PM +0100, Richard wrote:
>> Since when upload-pack and receive-pack run hooks they leave GIT_NAMESPACE set
>> there are hook scripts that expect that the current namespace is ignored,
>> so commands that now want to be namespace aware would have to opt-in.
>
> That seems really unfortunate.  While at the time we wanted to start
> with namespace support in upload-pack and receive-pack (and
> http-backend) because those would allow using it as a server-side
> storage format, I don't think we realized that leaving GIT_NAMESPACE in
> the hook environment would completely prevent other git commands from
> automatically handling namespaces.
>
> And conversely, we can't just have upload-pack and receive-pack start
> removing it from the hook environment, because a hook might expect to
> read the current namespace from it (and then run git commands that the
> hook expects will ignore it).

This is exactly what I've had to do for my proof of concept https://git.gitano.org.uk/cgit.git/commit/?h=richardmaw/namespaces&id=379124469a8a13208f976eb816375b00901ae77f

Show 5 quoted lines
> For that matter, someone could run "GIT_NAMESPACE=foo git push
> remotename branchname" or
> "GIT_NAMESPACE=foo git clone remotename", and based on the current
> behavior, they'd expect to have the namespace apply to the remote end,
> but not the local end.

I'm fairly sure this isn't the case, at least from what I've tried. At one point it appeared to be working, but that was just because it started the upload-pack as a subprocess, which inherited the GIT_NAMESPACE environment variable rather than being passed it. I think this is why the test suite always sets up a remote with the ext:: helper so it can set --namespace=foo in the command.

This is one of the reasons why I have been working on namespace support in the git server, you have to encode the namespace in the url somehow since it isn't passed through the git protocol.

We were thinking of adding ssh://git@server/~username/repo/path.git syntax for letting users have their own private namespace in a repository, and later extending the backend of the git server's repository storage so that other repositories could just be namespaces of a different repository so we could do something like repository forks provided the repositories have the same availability.

Show 8 quoted lines
> Unfortunately, I think at this point, GIT_NAMESPACE has to exclusively
> refer to the namespace for the remote end, to avoid breakage.  Which
> means any automatic pervasive support for namespaces on the local side
> would need to use a different mechanism.  (In addition to applying to
> ref enumeration, this would also need to apply to the local end of
> refspecs.)  And this new mechanism would need to not affect the remote
> end, to allow remapping the local end while accessing an un-namespaced
> (or differently namespaced) remote.

The problem for hooks is that it is implicitly inherited, so it could work if upload-pack receive-pack and http-backend work with GIT_NAMESPACE set, but everything else that wants to use a namespace has to set --namespace on the command-line.

Previous: Josh TriplettNext: Josh Triplett
Message 3 of 7 in “Adding more namespace support to git”
  1. RichardAug 20, 2016
  2. Josh TriplettAug 21, 2016
  3. RichardAug 21, 2016
  4. Josh TriplettAug 21, 2016
  5. Jeff KingAug 24, 2016
  6. Josh TriplettAug 22, 2016
  7. RichardAug 22, 2016

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.