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

Re: [PATCH 1/3] serve: pass "config context" through to individual commands

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 14, 2018, 09:28 UTC
Message-ID
<20181214092820.GB7121@google.com>
In-Reply-To
<20181214085507.GD11777@sigill.intra.peff.net>
Jeff King wrote:
> On Fri, Dec 14, 2018 at 12:36:21AM -0800, Jonathan Nieder wrote:
>> Jeff King wrote:
Show 13 quoted lines
>>> In protocol v2, instead of just running "upload-pack", we have a generic
>>> "serve" loop which runs command requests from the client. What used to
>>> be "upload-pack" is now generally split into two operations: "ls-refs"
>>> and "fetch". The latter knows it must respect uploadpack.* config, but
>>> the former is not actually specific to a fetch operation (we do not yet
>>> do v2 receive-pack, but eventually we may, and ls-refs would support
>>> both operations).
>>
>> I think I'm missing something.  Why wouldn't "ls-refs for push" not pass
>> the information that it's for push as part of the *body* of the ls-refs
>> request?
>
> I don't know. Why doesn't the current "ls-refs" say "ls-refs for fetch"?
Also YAGNI. ;-)

In other words, since the design for push isn't set in stone yet, we had nothing to be consistent with. And if there's an option to ls-ref to indicate whether it's for fetch or for push, then it can default to fetch.

As an aside, my experience from teaching people about Git protocol is that the concept of "ls-remote for push" producing a different result from "git ls-remote" is very confusing. Given what it is used for, I am motivated to replace it with something more tailored.

> Certainly if that information was carried from the client request it
> would work fine, and ls-refs would have enough to know which config to
> respect. But I could not find any documentation on this, nor discussion
> of plans for a v2 push.

Interesting. The last discussion of push v2 plans was in https://public-inbox.org/git/20180717210915.139521-1-bmwill@google.com/. Expect to hear more soon.

Show 7 quoted lines
>                         Since that information isn't passed now, we'd
> have to assume that "ls-refs" without "for-push" always means "for
> fetch".
>
> I'm conceptually OK with that, but if that is the plan for going
> forward, it was not at all obvious to me (and it does feel rather
> implicit).

Don't get me wrong: I haven't wrapped my head around config context and how it fits into the broader picture yet, but it may be a very good thing to have. So please consider this comment to be about the commit message only.

Based on the motivation you're describing here, I think treating it as uploadpack and adding a NEEDSWORK comment would be a good way forward. If we're moving toward a world with more protocol commands that don't fit in the upload-pack / receive-pack categories, then we need to figure out in more detail what that world looks like:

- do we keep on adding new endpoints, in the same spirit as
  upload-archive?  If so, what endpoint should a client use to get
  capabilities before it decides which endpoint to use?
- do we merge everything in "git serve" except where a specific
  endpoint is needed for protocol v0 compatibility?  That would lose
  the ability to distinguish fetches from pushes without looking at
  the body of requests (which is useful to some people for monitoring,
  blocking, etc) --- do we consider that to be an acceptable loss?
- once we've decided what the future should look like, how does the
  transition to that future look?
Show 7 quoted lines
>> Is there some other more immediate motivation for this patch?  In the
>> spirit of YAGNI, I would rather understand that motivation instead of
>> one that in many possible designs would never materialize.
>
> Without this information, in patch 3 ls-refs cannot know to look at
> uploadpack.hiderefs, unless it makes the implicit assumption that it is
> always serving a fetch.

I think that's a reasonable assumption to make, especially if made explicit using a simple comment. :)

Thanks for explaining, Jonathan

Previous: Jeff KingNext: Jeff King
Message 11 of 73 in “protocol v2 and hidden refs”
  1. 0/3 protocol v2 and hidden refsJeff King, Dec 11, 2018
  2. 1/3 serve: pass "config context" through to individual commandsJeff King, Dec 11, 2018
  3. Junio C HamanoDec 14, 2018
  4. Jeff KingDec 14, 2018
  5. Junio C HamanoDec 15, 2018
  6. Jeff KingDec 16, 2018
  7. Junio C HamanoDec 16, 2018
  8. Jeff KingDec 18, 2018
  9. Jonathan NiederDec 14, 2018
  10. Jeff KingDec 14, 2018
  11. Jonathan NiederDec 14, 2018
  12. Jeff KingDec 14, 2018
  13. 2/3 parse_hide_refs_config: handle NULL sectionJeff King, Dec 11, 2018
  14. Junio C HamanoDec 14, 2018
  15. 3/3 upload-pack: support hidden refs with protocol v2Jeff King, Dec 11, 2018
  16. Ævar Arnfjörð BjarmasonDec 11, 2018
  17. Jeff KingDec 11, 2018
  18. 0/3 Add a GIT_TEST_PROTOCOL_VERSION=X test modeÆvar Arnfjörð Bjarmason, Dec 11, 2018
  19. Ævar Arnfjörð BjarmasonDec 11, 2018
  20. 1/3 tests: add a special setup where for protocol.versionÆvar Arnfjörð Bjarmason, Dec 11, 2018
  21. 0/3 Some fixes and improvementsJonathan Tan, Dec 12, 2018
  22. 1/3 squash this into your patchJonathan Tan, Dec 12, 2018
  23. 3/3 also squash this into your patchJonathan Tan, Dec 12, 2018
  24. 2/3 builtin/fetch-pack: support protocol version 2Jonathan Tan, Dec 12, 2018
  25. Junio C HamanoDec 13, 2018
  26. 0/8 protocol v2 fixesÆvar Arnfjörð Bjarmason, Dec 13, 2018
  27. 0/4 protocol v2 fixesÆvar Arnfjörð Bjarmason, Dec 17, 2018
  28. Jeff KingDec 18, 2018
  29. 1/4 serve: pass "config context" through to individual commandsÆvar Arnfjörð Bjarmason, Dec 17, 2018
  30. 3/4 upload-pack: support hidden refs with protocol v2Ævar Arnfjörð Bjarmason, Dec 17, 2018
  31. 2/4 parse_hide_refs_config: handle NULL sectionÆvar Arnfjörð Bjarmason, Dec 17, 2018
  32. 4/4 fetch-pack: support protocol version 2Ævar Arnfjörð Bjarmason, Dec 17, 2018
  33. Junio C HamanoJan 8, 2019
  34. Jonathan TanJan 8, 2019
  35. Jeff KingJan 8, 2019
  36. 1/8 serve: pass "config context" through to individual commandsÆvar Arnfjörð Bjarmason, Dec 13, 2018
  37. 2/8 parse_hide_refs_config: handle NULL sectionÆvar Arnfjörð Bjarmason, Dec 13, 2018
  38. 3/8 upload-pack: support hidden refs with protocol v2Ævar Arnfjörð Bjarmason, Dec 13, 2018
  39. 4/8 tests: add a check for unportable env --unsetÆvar Arnfjörð Bjarmason, Dec 13, 2018
  40. 5/8 tests: add a special setup where for protocol.versionÆvar Arnfjörð Bjarmason, Dec 13, 2018
  41. Jonathan TanDec 13, 2018
  42. 6/8 tests: mark & fix tests broken under GIT_TEST_PROTOCOL_VERSION=1Ævar Arnfjörð Bjarmason, Dec 13, 2018
  43. 7/8 builtin/fetch-pack: support protocol version 2Ævar Arnfjörð Bjarmason, Dec 13, 2018
  44. Jeff KingDec 14, 2018
  45. 8/8 tests: mark tests broken under GIT_TEST_PROTOCOL_VERSION=2Ævar Arnfjörð Bjarmason, Dec 13, 2018
  46. Ævar Arnfjörð BjarmasonDec 13, 2018
  47. Junio C HamanoDec 14, 2018
  48. Jeff KingDec 14, 2018
  49. Ævar Arnfjörð BjarmasonDec 14, 2018
  50. Ævar Arnfjörð BjarmasonDec 14, 2018
  51. Jeff KingDec 17, 2018
  52. Jeff KingDec 17, 2018
  53. upload-pack: turn on uploadpack.allowAnySHA1InWant=trueÆvar Arnfjörð Bjarmason, Dec 17, 2018
  54. David TurnerDec 17, 2018
  55. Ævar Arnfjörð BjarmasonDec 17, 2018
  56. David TurnerDec 17, 2018
  57. Jonathan NiederDec 17, 2018
  58. Ævar Arnfjörð BjarmasonDec 17, 2018
  59. Jonathan NiederDec 18, 2018
  60. Ævar Arnfjörð BjarmasonDec 18, 2018
  61. Jeff KingDec 18, 2018
  62. Jeff KingDec 18, 2018
  63. Ævar Arnfjörð BjarmasonDec 18, 2018
  64. Junio C HamanoDec 26, 2018
  65. Ævar Arnfjörð BjarmasonDec 27, 2018
  66. Jonathan NiederDec 27, 2018
  67. 2/3 tests: mark tests broken under GIT_TEST_PROTOCOL_VERSION=1Ævar Arnfjörð Bjarmason, Dec 11, 2018
  68. 3/3 tests: mark tests broken under GIT_TEST_PROTOCOL_VERSION=2Ævar Arnfjörð Bjarmason, Dec 11, 2018
  69. Jonathan TanDec 13, 2018
  70. Jeff KingDec 14, 2018
  71. Ævar Arnfjörð BjarmasonDec 15, 2018
  72. Jeff KingDec 16, 2018
  73. Ævar Arnfjörð BjarmasonDec 16, 2018

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.