<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fetch-pack.c, branch v2.20.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.20.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.20.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-11-01T05:30:22Z</updated>
<entry>
<title>fetch-pack: be more precise in parsing v2 response</title>
<updated>2018-11-01T05:30:22Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2018-10-19T22:54:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5400b2a2d989a4f09e7f666a41efac9ee3936f10'/>
<id>urn:sha1:5400b2a2d989a4f09e7f666a41efac9ee3936f10</id>
<content type='text'>
Each section in a protocol v2 response is followed by either a DELIM
packet (indicating more sections to follow) or a FLUSH packet
(indicating none to follow). But when parsing the "acknowledgments"
section, do_fetch_pack_v2() is liberal in accepting both, but determines
whether to continue reading or not based solely on the contents of the
"acknowledgments" section, not on whether DELIM or FLUSH was read.

There is no issue with a protocol-compliant server, but can result in
confusing error messages when communicating with a server that
serves unexpected additional sections. Consider a server that sends
"new-section" after "acknowledgments":

 - client writes request
 - client reads the "acknowledgments" section which contains no "ready",
   then DELIM
 - since there was no "ready", client needs to continue negotiation, and
   writes request
 - client reads "new-section", and reports to the end user "expected
   'acknowledgments', received 'new-section'"

For the person debugging the involved Git implementation(s), the error
message is confusing in that "new-section" was not received in response
to the latest request, but to the first one.

One solution is to always continue reading after DELIM, but in this
case, we can do better. We know from the protocol that "ready" means at
least the packfile section is coming (hence, DELIM) and that no "ready"
means that no sections are to follow (hence, FLUSH). So teach
process_acks() to enforce this.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'tb/filter-alternate-refs'</title>
<updated>2018-10-19T04:34:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-19T04:34:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=465e73fff380808f0ba3fb17984ab8636afb6405'/>
<id>urn:sha1:465e73fff380808f0ba3fb17984ab8636afb6405</id>
<content type='text'>
When pushing into a repository that borrows its objects from an
alternate object store, "git receive-pack" that responds to the
push request on the other side lists the tips of refs in the
alternate to reduce the amount of objects transferred.  This
sometimes is detrimental when the number of refs in the alternate
is absurdly large, in which case the bandwidth saved in potentially
fewer objects transferred is wasted in excessively large ref
advertisement.  The alternate refs that are advertised are now
configurable with a pair of configuration variables.

* tb/filter-alternate-refs:
  transport.c: introduce core.alternateRefsPrefixes
  transport.c: introduce core.alternateRefsCommand
  transport.c: extract 'fill_alternate_refs_command'
  transport: drop refnames from for_each_alternate_ref
</content>
</entry>
<entry>
<title>Merge branch 'jt/avoid-ls-refs'</title>
<updated>2018-10-19T04:34:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-19T04:34:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0527fbab689929de47ab3fa7baf1e7618ffa704f'/>
<id>urn:sha1:0527fbab689929de47ab3fa7baf1e7618ffa704f</id>
<content type='text'>
Over some transports, fetching objects with an exact commit object
name can be done without first seeing the ref advertisements.  The
code has been optimized to exploit this.

* jt/avoid-ls-refs:
  fetch: do not list refs if fetching only hashes
  transport: list refs before fetch if necessary
  transport: do not list refs if possible
  transport: allow skipping of ref listing
</content>
</entry>
<entry>
<title>Merge branch 'jt/non-blob-lazy-fetch'</title>
<updated>2018-10-19T04:34:07Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-19T04:34:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fa54cccf1ffcf4b49076d24062f3592b73e2bb84'/>
<id>urn:sha1:fa54cccf1ffcf4b49076d24062f3592b73e2bb84</id>
<content type='text'>
A partial clone that is configured to lazily fetch missing objects
will on-demand issue a "git fetch" request to the originating
repository to fill not-yet-obtained objects.  The request has been
optimized for requesting a tree object (and not the leaf blob
objects contained in it) by telling the originating repository that
no blobs are needed.

* jt/non-blob-lazy-fetch:
  fetch-pack: exclude blobs when lazy-fetching trees
  fetch-pack: avoid object flags if no_dependents
</content>
</entry>
<entry>
<title>transport: drop refnames from for_each_alternate_ref</title>
<updated>2018-10-09T05:30:02Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-10-08T18:09:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bdf4276c91623cf57efefd2ada7fb3e0709e2230'/>
<id>urn:sha1:bdf4276c91623cf57efefd2ada7fb3e0709e2230</id>
<content type='text'>
None of the current callers use the refname parameter we pass to their
callbacks. In theory somebody _could_ do so, but it's actually quite
weird if you think about it: it's a ref in somebody else's repository.
So the name has no meaning locally, and in fact there may be duplicates
if there are multiple alternates.

The users of this interface really only care about seeing some ref tips,
since that promises that the alternate has the full commit graph
reachable from there. So let's keep the information we pass back to the
bare minimum.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Taylor Blau &lt;me@ttaylorr.com&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>transport: do not list refs if possible</title>
<updated>2018-10-07T00:53:15Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2018-09-27T19:24:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=01775651481ecd9c7288a85cfb7999f7f38ab37c'/>
<id>urn:sha1:01775651481ecd9c7288a85cfb7999f7f38ab37c</id>
<content type='text'>
When all refs to be fetched are exact OIDs, it is possible to perform a
fetch without requiring the remote to list refs if protocol v2 is used.
Teach Git to do this.

This currently has an effect only for lazy fetches done from partial
clones. The change necessary to likewise optimize "git fetch &lt;remote&gt;
&lt;sha-1&gt;" will be done in a subsequent patch.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: load tip_oids eagerly iff needed</title>
<updated>2018-10-04T18:12:13Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2018-10-04T15:09:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=22a164651114738c723c4459140e1e5330491467'/>
<id>urn:sha1:22a164651114738c723c4459140e1e5330491467</id>
<content type='text'>
tip_oids_contain() lazily loads refs into an oidset at its first call.
It abuses the internal (sub)member .map.tablesize of that oidset to
check if it has done that already.

Determine if the oidset needs to be populated upfront and then do that
instead.  This duplicates a loop, but simplifies the existing one by
separating concerns between the two.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: factor out is_unmatched_ref()</title>
<updated>2018-10-04T18:12:13Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2018-10-04T15:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bf73282c0b34bfc7772f952496b06150cceb5dae'/>
<id>urn:sha1:bf73282c0b34bfc7772f952496b06150cceb5dae</id>
<content type='text'>
Move the code to determine if a request is unmatched to its own little
helper.  This allows us to reuse it in a subsequent patch.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: exclude blobs when lazy-fetching trees</title>
<updated>2018-10-04T13:03:49Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2018-10-03T23:04:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4c7f9567ea2628451a0f4ad52599a25d34657bae'/>
<id>urn:sha1:4c7f9567ea2628451a0f4ad52599a25d34657bae</id>
<content type='text'>
A partial clone with missing trees can be obtained using "git clone
--filter=tree:none &lt;repo&gt;". In such a repository, when a tree needs to
be lazily fetched, any tree or blob it directly or indirectly references
is fetched as well, regardless of whether the original command required
those objects, or if the local repository already had some of them.

This is because the fetch protocol, which the lazy fetch uses, does not
allow clients to request that only the wanted objects be sent, which
would be the ideal solution. This patch implements a partial solution:
specify the "blob:none" filter, somewhat reducing the fetch payload.

This change has no effect when lazily fetching blobs (due to how filters
work). And if lazily fetching a commit (such repositories are difficult
to construct and is not a use case we support very well, but it is
possible), referenced commits and trees are still fetched - only the
blobs are not fetched.

The necessary code change is done in fetch_pack() instead of somewhere
closer to where the "filter" instruction is written to the wire so that
only one part of the code needs to be changed in order for users of all
protocol versions to benefit from this optimization.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: avoid object flags if no_dependents</title>
<updated>2018-10-04T13:00:53Z</updated>
<author>
<name>Jonathan Tan</name>
<email>jonathantanmy@google.com</email>
</author>
<published>2018-10-03T23:04:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=12f19a9825686e3641803580bda4e2ab2abd44ed'/>
<id>urn:sha1:12f19a9825686e3641803580bda4e2ab2abd44ed</id>
<content type='text'>
When fetch_pack() is invoked as part of another Git command (due to a
lazy fetch from a partial clone, for example), it uses object flags that
may already be used by the outer Git command.

The commit that introduced the lazy fetch feature (88e2f9ed8e
("introduce fetch-object: fetch one promisor object", 2017-12-05)) tried
to avoid this overlap, but it did not avoid it totally. It was
successful in avoiding writing COMPLETE, but did not avoid reading
COMPLETE, and did not avoid writing and reading ALTERNATE.

Ensure that no flags are written or read by fetch_pack() in the case
where it is used to perform a lazy fetch. To do this, it is sufficient
to avoid checking completeness of wanted refs (unnecessary in the case
of lazy fetches), and to avoid negotiation-related work (in the current
implementation, already, no negotiation is performed). After that was
done, the lack of overlap was verified by checking all direct and
indirect usages of COMPLETE and ALTERNATE - that they are read or
written only if no_dependents is false.

There are other possible solutions to this issue:

 (1) Split fetch-pack.{c,h} into a flag-using part and a non-flag-using
     part, and whenever no_dependents is set, only use the
     non-flag-using part.
 (2) Make fetch_pack() be able to be used with arbitrary repository
     objects. fetch_pack() should then create its own repository object
     based on the given repository object, with its own object
     hashtable, so that the flags do not conflict.

(1) is possible but invasive - some functions would need to be split;
and such invasiveness would potentially be unnecessary if we ever were
to need (2) anyway. (2) would be useful if we were to support, say,
submodules that were partial clones themselves, but I don't know when or
if the Git project plans to support those.

Signed-off-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
