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

Re: [PATCH v2 2/8] upload-pack: implement ref-in-want

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 15, 2018, 21:08 UTC
Message-ID
<xmqq602jzriy.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180613213925.10560-3-bmwill@google.com>
Brandon Williams <bmwill@google.com> writes:
Show 5 quoted lines
> Currently, while performing packfile negotiation, clients are only
> allowed to specify their desired objects using object ids.  This causes
> a vulnerability to failure when an object turns non-existent during
> negotiation, which may happen if, for example, the desired repository is
> provided by multiple Git servers in a load-balancing arrangement.

In other words, your "git fetch refs/heads/master" initially contacts a mirror A and learns that its refs/heads/master is at commit X, starts negotiation, and end up with getting served by a mirror B that is slightly beind mirror A, which wants to give you a packfile that brings you up to say commit X~3. You want to be able to say "I want to update my refs/remotes/origin/master with whatever is (close to) the latest at your refs/heads/master", not "I just learned refs/heads/master is at X from one of you, I demand getting updated to that exact commit."

For that, you'd say, after getting ref advertisement, "I want the tip of refs/heads/master that one of you have, whoever ends up serving me eventually".

Show 5 quoted lines
> +    want-ref <ref>
> +	Indicates to the server that the client wants to retrieve a
> +	particular ref, where <ref> is the full name of a ref on the
> +	server.  A server should ignore any "want-ref <ref>" lines where
> +	<ref> doesn't exist on the server.

But when you said "I want some version of refs/heads/bo", is it sensible for me to say "Oh, among 7 mirrors, you unluckily ended up with me who is most behind and do not even have 'bo' branch yet, so I won't be giving you that branch (or history leading to the commit my 6 friends may have at refs/heads/bo)"?

What is the end-user visible effect of "ignoring"? Does your "git fetch bo" that were unluckily served by me who do not yet have the branch error out? If so, preferrably the conversation should faile before packfile generation and transfer.

I am guessing that you do not want to fail the negotiation if your "git fetch bo" happen to contact me (who lack 'bo') first, as long as the conversation continues and switches later to one of my friends who can fulfill the request, and that is why you are forbidding me (who got initial contact and saw "want-ref bo") from failing the whole thing. But it is unclear who is responsible for erroring out the whole "git fetch bo" *if* unlucky you ended up getting served by the most stale mirror that does not even have 'bo'.

The story would be different if your request were 
	git fetch refs/heads/*:refs/remotes/origin/*

in which case, you are not even saying "I want this and that ref"; you are saying "all refs in refs/heads/* whoever ends up serving me happens to have". You may initially contact one of my friends and learn that there are 'master' and 'bo' branches (and probably others), and after conversation end up talking with me who is stale and lack 'bo'. In such a case, I agree that it is not sensible for me to fail the request as a whole and instead serve you whatever branches I happen to have. I may lack 'bo' branch due to mirroring lag, but I may also have 'extra' branch that others no longer have due to mirroring lag of deletion of that branch!

But then I think your "git fetch refs/heads/*:refs/remotes/origin/*" should not fail not just because I do not have 'bo', but you also should grab other old branches I have, which you didn't hear about when you made the initial contact with my friend in the mirror pool.

So, given that, would it make sense for 'want-ref <ref>' request to name "a particular ref" as the above document says? I have a feeling that it should allow a pattern to be matched at the server side (and it is not an error if the pattern did not match anything), in addition to asking for a particular ref (in which case, lack of that ref should be a hard failure, at least for the mirror that ends up serving the packfile and the final "here are the refs your request ended up fetching, with their values").

Show 8 quoted lines
>  The response of `fetch` is broken into a number of sections separated by
>  delimiter packets (0001), with each section beginning with its section
>  header.
>  
>      output = *section
> -    section = (acknowledgments | shallow-info | packfile)
> +    section = (acknowledgments | shallow-info | wanted-refs | packfile)
>  	      (flush-pkt | delim-pkt)

OK. In my initial reading, I somehow failed to read this piece before going on to the next hunk ...

Show 8 quoted lines
> @@ -319,6 +329,10 @@ header.
>      shallow = "shallow" SP obj-id
>      unshallow = "unshallow" SP obj-id
>  
> +    wanted-refs = PKT-LINE("wanted-refs" LF)
> +		  *PKT-LINE(wanted-ref LF)
> +    wanted-ref = obj-id SP refname
> +

... and wondered how the reader knows where wanted-ref list ends; we will see a flush (or is it delim? either is accepted?) where the list ends, which is good.

Previous: Brandon WilliamsNext: Junio C Hamano
Message 22 of 122 in “ref-in-want”
  1. 0/8 ref-in-wantBrandon Williams, Jun 5, 2018
  2. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 5, 2018
  3. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 5, 2018
  4. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 5, 2018
  5. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 5, 2018
  6. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 5, 2018
  7. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 5, 2018
  8. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 5, 2018
  9. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 5, 2018
  10. Ramsay JonesJun 5, 2018
  11. Ævar Arnfjörð BjarmasonJun 5, 2018
  12. Brandon WilliamsJun 6, 2018
  13. Ævar Arnfjörð BjarmasonJun 6, 2018
  14. Brandon WilliamsJun 6, 2018
  15. 0/8 ref-in-wantBrandon Williams, Jun 13, 2018
  16. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 13, 2018
  17. Stefan BellerJun 14, 2018
  18. Brandon WilliamsJun 14, 2018
  19. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 13, 2018
  20. Stefan BellerJun 14, 2018
  21. Brandon WilliamsJun 14, 2018
  22. Junio C HamanoJun 15, 2018
  23. Junio C HamanoJun 15, 2018
  24. Brandon WilliamsJun 19, 2018
  25. Junio C HamanoJun 19, 2018
  26. Brandon WilliamsJun 19, 2018
  27. Junio C HamanoJun 21, 2018
  28. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 13, 2018
  29. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 13, 2018
  30. Stefan BellerJun 14, 2018
  31. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 13, 2018
  32. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 13, 2018
  33. Stefan BellerJun 14, 2018
  34. Brandon WilliamsJun 14, 2018
  35. Jonathan NiederJun 22, 2018
  36. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 13, 2018
  37. Stefan BellerJun 14, 2018
  38. Jonathan TanJun 14, 2018
  39. Brandon WilliamsJun 19, 2018
  40. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 13, 2018
  41. Stefan BellerJun 14, 2018
  42. Junio C HamanoJun 15, 2018
  43. Brandon WilliamsJun 18, 2018
  44. 0/8 ref-in-wantBrandon Williams, Jun 20, 2018
  45. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 20, 2018
  46. Jonathan NiederJun 22, 2018
  47. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 20, 2018
  48. Jonathan TanJun 25, 2018
  49. Jonathan TanJun 25, 2018
  50. Brandon WilliamsJun 25, 2018
  51. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 20, 2018
  52. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 20, 2018
  53. Jonathan TanJun 25, 2018
  54. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 20, 2018
  55. Jonathan NiederJun 22, 2018
  56. Jonathan NiederJun 22, 2018
  57. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 20, 2018
  58. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 20, 2018
  59. Jonathan NiederJun 22, 2018
  60. Brandon WilliamsJun 25, 2018
  61. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 20, 2018
  62. Jonathan TanJun 25, 2018
  63. Brandon WilliamsJun 25, 2018
  64. 0/8 ref-in-wantBrandon Williams, Jun 25, 2018
  65. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 25, 2018
  66. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 25, 2018
  67. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 25, 2018
  68. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 25, 2018
  69. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 25, 2018
  70. Jonathan TanJun 25, 2018
  71. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 25, 2018
  72. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 25, 2018
  73. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 25, 2018
  74. Jonathan TanJun 25, 2018
  75. Jonathan TanJun 25, 2018
  76. 0/8 ref-in-wantBrandon Williams, Jun 26, 2018
  77. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 26, 2018
  78. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 26, 2018
  79. Junio C HamanoJun 26, 2018
  80. Brandon WilliamsJun 27, 2018
  81. Junio C HamanoJun 27, 2018
  82. Brandon WilliamsJun 27, 2018
  83. Stefan BellerJun 27, 2018
  84. Jonathan TanJun 27, 2018
  85. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 26, 2018
  86. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 26, 2018
  87. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 26, 2018
  88. Junio C HamanoJun 26, 2018
  89. Brandon WilliamsJun 27, 2018
  90. Jonathan TanJun 27, 2018
  91. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 26, 2018
  92. Jonathan TanJun 27, 2018
  93. Brandon WilliamsJun 27, 2018
  94. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 26, 2018
  95. Junio C HamanoJun 26, 2018
  96. Brandon WilliamsJun 27, 2018
  97. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 26, 2018
  98. Junio C HamanoJun 26, 2018
  99. 0/8 ref-in-wantBrandon Williams, Jun 27, 2018
  100. 1/8 test-pkt-line: add unpack-sideband subcommandBrandon Williams, Jun 27, 2018
  101. 2/8 upload-pack: implement ref-in-wantBrandon Williams, Jun 27, 2018
  102. 3/8 upload-pack: test negotiation with changing repositoryBrandon Williams, Jun 27, 2018
  103. 5/8 fetch: refactor fetch_refs into two functionsBrandon Williams, Jun 27, 2018
  104. 4/8 fetch: refactor the population of peer ref OIDsBrandon Williams, Jun 27, 2018
  105. 7/8 fetch-pack: put shallow info in output parameterBrandon Williams, Jun 27, 2018
  106. 6/8 fetch: refactor to make function args narrowerBrandon Williams, Jun 27, 2018
  107. 8/8 fetch-pack: implement ref-in-wantBrandon Williams, Jun 27, 2018
  108. Duy NguyenJul 22, 2018
  109. Brandon WilliamsJul 23, 2018
  110. Duy NguyenJul 23, 2018
  111. Jonathan NiederJul 23, 2018
  112. fetch-pack: mark die strings for translationBrandon Williams, Jul 23, 2018
  113. Stefan BellerJul 23, 2018
  114. Jonathan NiederJul 23, 2018
  115. Junio C HamanoJul 23, 2018
  116. Junio C HamanoJul 23, 2018
  117. Brandon WilliamsJul 23, 2018
  118. Jonathan TanJun 15, 2018
  119. Brandon WilliamsJun 19, 2018
  120. Jonathan TanJun 19, 2018
  121. Brandon WilliamsJun 19, 2018
  122. Jonathan TanJun 19, 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.