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

Re: [PATCHv4 2/4] Add infrastructure for ref namespaces

From
Josh Triplett <josh@joshtriplett.org>
Date
Jun 3, 2011, 17:26 UTC
Message-ID
<20110603172612.GC3839@leaf>
In-Reply-To
<7vvcwnbpat.fsf@alter.siamese.dyndns.org>
On Thu, Jun 02, 2011 at 07:51:22PM -0700, Junio C Hamano wrote:
Show 27 quoted lines
> Josh Triplett <josh@joshtriplett.org> writes:
> 
> > ... I don't think it
> > makes sense to support passing in arbitrary namespaces when the callers
> > only use it to access the currently requested namespace.  If some
> > situation arises in later code that needs to handle arbitrary
> > namespaces, it seems easy enough to provide a more generalized function
> > at that point, but doing so now would just make the existing callers
> > more complex by forcing them to do the call to get_git_namespace()
> > rather than allowing for_each_namespaced_ref to do it.
> 
> If you do not pass the namespace around from day one, wouldn't it make it
> more cumbersome to later extend the API so that you can have more than one
> namespace active at the same time? For example, even with today's code,
> when responding to a push, the receiving repository issues a ls-remote
> request to its alternate repository to learn the tips of its refs, and at
> that point, the side of you who is responding to a push is using the
> namespace from the push client, while you acting as a fetch/ls-remote
> client would be in a different namespace. The different namespace happens
> to be "no funny namespace business" plain vanilla one, but I think you get
> the point. I do not mind seeing the very top-level caller of ref iterator
> calling get-namespace, but I would find it a bad taste if a function very
> deep in a callchain has to call get-namespace (meaning, you can only have
> one namespace active at a time) only because the caller does not pass it
> in.
> 
> But perhaps I am looking too far into the future and worried too much.

I do understand your concern, and in the future some tools might need to support multiple namespaces, but for now all the users only need to use GIT_NAMESPACE, and I'd prefer to tailor the API for the convenience of the callers that exist now on the assumption that the API seems trivial to change later if it turns out we need it. I don't think it makes sense to try to design that future API without specific callers in mind.

- Josh Triplett
Previous: Junio C HamanoNext: Jakub Narebski
Message 6 of 20 in “[PATCHv4 1/4] Refactor for_each_ref variants to use for_each_ref_in and avoid magic numbers”
  1. Jamey SharpJun 1, 2011
  2. 2/4 Add infrastructure for ref namespacesJamey Sharp, Jun 1, 2011
  3. Junio C HamanoJun 2, 2011
  4. Josh TriplettJun 2, 2011
  5. Junio C HamanoJun 3, 2011
  6. Josh TriplettJun 3, 2011
  7. Jakub NarebskiJun 3, 2011
  8. Josh TriplettJun 3, 2011
  9. Jakub NarebskiJun 8, 2011
  10. Josh TriplettJun 9, 2011
  11. Jakub NarebskiJun 9, 2011
  12. 3/4 Support ref namespaces for remote repositories via upload-pack and receive-packJamey Sharp, Jun 1, 2011
  13. Junio C HamanoJun 2, 2011
  14. josh@joshtriplett.orgJun 3, 2011
  15. Junio C HamanoJun 3, 2011
  16. 4/4 Add documentation for ref namespacesJamey Sharp, Jun 1, 2011
  17. Junio C HamanoJun 2, 2011
  18. Josh TriplettJun 2, 2011
  19. Junio C HamanoJun 2, 2011
  20. Jakub NarebskiJun 3, 2011

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.