<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/fetch-pack.c, branch v2.36.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.36.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.36.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-03-28T17:25:52Z</updated>
<entry>
<title>fetch-pack: add refetch</title>
<updated>2022-03-28T17:25:52Z</updated>
<author>
<name>Robert Coup</name>
<email>robert@coup.net.nz</email>
</author>
<published>2022-03-28T14:02:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4dfd0925cbba78cc737e3af29faa5774bbc7b6a3'/>
<id>urn:sha1:4dfd0925cbba78cc737e3af29faa5774bbc7b6a3</id>
<content type='text'>
Allow a "refetch" where the contents of the local object store are
ignored and a full fetch is performed, not attempting to find or
negotiate common commits with the remote.

A key use case is to apply a new partial clone blob/tree filter and
refetch all the associated matching content, which would otherwise not
be transferred when the commit objects are already present locally.

Signed-off-by: Robert Coup &lt;robert@coup.net.nz&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ps/fetch-optim-with-commit-graph'</title>
<updated>2022-02-24T00:58:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-24T00:58:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=68fd3b35f7ad703fd94218b9faf42baa34819f93'/>
<id>urn:sha1:68fd3b35f7ad703fd94218b9faf42baa34819f93</id>
<content type='text'>
A couple of optimization to "git fetch".

* ps/fetch-optim-with-commit-graph:
  fetch: skip computing output width when not printing anything
  fetch-pack: use commit-graph when computing cutoff
</content>
</entry>
<entry>
<title>Merge branch 'bs/forbid-i18n-of-protocol-token-in-fetch-pack'</title>
<updated>2022-02-24T00:58:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-24T00:58:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c69e455bbced1ae89ff386af889b65ad0b3b0927'/>
<id>urn:sha1:c69e455bbced1ae89ff386af889b65ad0b3b0927</id>
<content type='text'>
L10n support for a few error messages.

* bs/forbid-i18n-of-protocol-token-in-fetch-pack:
  fetch-pack: parameterize message containing 'ready' keyword
</content>
</entry>
<entry>
<title>fetch-pack: parameterize message containing 'ready' keyword</title>
<updated>2022-02-11T22:37:09Z</updated>
<author>
<name>Bagas Sanjaya</name>
<email>bagasdotme@gmail.com</email>
</author>
<published>2021-12-22T07:58:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3d3c23b3a754cf5060a93d9f777e58662cdd5ffe'/>
<id>urn:sha1:3d3c23b3a754cf5060a93d9f777e58662cdd5ffe</id>
<content type='text'>
The protocol keyword 'ready' isn't meant for translation. Pass it as
parameter instead of spell it in die() message (and potentially confuse
translators).

Signed-off-by: Bagas Sanjaya &lt;bagasdotme@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: use commit-graph when computing cutoff</title>
<updated>2022-02-10T17:59:38Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2022-02-10T12:28:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6fd1cc8f985ccd8b014e945a819482b267dae21f'/>
<id>urn:sha1:6fd1cc8f985ccd8b014e945a819482b267dae21f</id>
<content type='text'>
During packfile negotiation we iterate over all refs announced by the
remote side to check whether their IDs refer to commits already known to
us. If a commit is known to us already, then its date is a potential
cutoff point for commits we have in common with the remote side.

There is potentially a lot of commits announced by the remote depending
on how many refs there are in the remote repository, and for every one
of them we need to search for it in our object database and, if found,
parse the corresponding object to find out whether it is a candidate for
the cutoff date. This can be sped up by trying to look up commits via
the commit-graph first, which is a lot more efficient.

Benchmarks in a repository with about 2,1 million refs and an up-to-date
commit-graph show an almost 20% speedup when mirror-fetching:

    Benchmark 1: git fetch +refs/*:refs/* (v2.35.0)
      Time (mean ± σ):     115.587 s ±  2.009 s    [User: 109.874 s, System: 11.305 s]
      Range (min … max):   113.584 s … 118.820 s    5 runs

    Benchmark 2: git fetch +refs/*:refs/* (HEAD)
      Time (mean ± σ):     96.859 s ±  0.624 s    [User: 91.948 s, System: 10.980 s]
      Range (min … max):   96.180 s … 97.875 s    5 runs

    Summary
      'git fetch +refs/*:refs/* (HEAD)' ran
        1.19 ± 0.02 times faster than 'git fetch +refs/*:refs/* (v2.35.0)'

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>i18n: factorize "--foo requires --bar" and the like</title>
<updated>2022-01-05T21:31:00Z</updated>
<author>
<name>Jean-Noël Avila</name>
<email>jn.avila@free.fr</email>
</author>
<published>2022-01-05T20:02:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6fa00ee843cb6c8e720180b4642590f5bcc9c8cf'/>
<id>urn:sha1:6fa00ee843cb6c8e720180b4642590f5bcc9c8cf</id>
<content type='text'>
They are all replaced by "the option '%s' requires '%s'", which is a
new string but replaces 17 previous unique strings.

Signed-off-by: Jean-Noël Avila &lt;jn.avila@free.fr&gt;
Reviewed-by: Johannes Sixt &lt;j6t@kdbg.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/fetch-pack-avoid-sigpipe-to-index-pack'</title>
<updated>2021-12-10T22:35:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-12-10T22:35:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=353a27ad95b726e650b5782a1056c4ca81992efb'/>
<id>urn:sha1:353a27ad95b726e650b5782a1056c4ca81992efb</id>
<content type='text'>
"git fetch", when received a bad packfile, can fail with SIGPIPE.
This wasn't wrong per-se, but we now detect the situation and fail
in a more predictable way.

* jk/fetch-pack-avoid-sigpipe-to-index-pack:
  fetch-pack: ignore SIGPIPE when writing to index-pack
</content>
</entry>
<entry>
<title>fetch-pack: ignore SIGPIPE when writing to index-pack</title>
<updated>2021-11-19T22:22:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-11-19T20:58:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2a4aed42ecf6ee4ba8824423bd40010c3572aa0c'/>
<id>urn:sha1:2a4aed42ecf6ee4ba8824423bd40010c3572aa0c</id>
<content type='text'>
When fetching, we send the incoming pack to index-pack (or
unpack-objects) via the sideband demuxer. If index-pack hits an error
(e.g., because an object fails fsck), then it will die immediately. This
may cause us to get SIGPIPE on the fetch, as we're still trying to write
pack contents from the sideband demuxer (which is typically a thread,
and thus takes down the whole fetch process).

You can see this in action with:

  ./t5702-protocol-v2.sh --stress --run=59

which ends with (wrapped for readability):

  test_must_fail: died by signal 13: git -c protocol.version=2 \
    -c transfer.fsckobjects=1 -c fetch.uriprotocols=http,https \
    clone http://127.0.0.1:5708/smart/http_parent http_child
  not ok 59 - packfile-uri with transfer.fsckobjects fails on bad object

This is mostly cosmetic. The actual error of interest (in this case, the
object that failed the fsck check) comes from index-pack straight to
stderr, so the user still sees it. They _might_ even see fetch-pack
complaining about index-pack failing, because the main thread is racing
with the sideband-demuxer. But they'll definitely see the signal death
in the exit code, which is what the test is complaining about.

We can make this more predictable by just ignoring SIGPIPE. The sideband
demuxer uses write_or_die(), so it will notice and stop (gracefully,
because we hook die_routine() to exit just the thread). And during this
section we're not writing anywhere else where we'd be concerned about
SIGPIPE preventing us from wasting effort writing to nowhere.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: redact packfile urls in traces</title>
<updated>2021-11-11T18:07:43Z</updated>
<author>
<name>Ivan Frade</name>
<email>ifrade@google.com</email>
</author>
<published>2021-11-10T23:51:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=88e9b1e3fcbd3a8edcf1d54528c49f8237906aba'/>
<id>urn:sha1:88e9b1e3fcbd3a8edcf1d54528c49f8237906aba</id>
<content type='text'>
In some setups, packfile uris act as bearer token. It is not
recommended to expose them plainly in logs, although in special
circunstances (e.g. debug) it makes sense to write them.

Redact the packfile URL paths by default, unless the GIT_TRACE_REDACT
variable is set to false. This mimics the redacting of the Authorization
header in HTTP.

Signed-off-by: Ivan Frade &lt;ifrade@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch-pack: optimize loading of refs via commit graph</title>
<updated>2021-09-01T19:43:56Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2021-09-01T13:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=62b5a35a33ad6a4537e2ae75a49036e4173fcc87'/>
<id>urn:sha1:62b5a35a33ad6a4537e2ae75a49036e4173fcc87</id>
<content type='text'>
In order to negotiate a packfile, we need to dereference refs to see
which commits we have in common with the remote. To do so, we first look
up the object's type -- if it's a tag, we peel until we hit a non-tag
object. If we hit a commit eventually, then we return that commit.

In case the object ID points to a commit directly, we can avoid the
initial lookup of the object type by opportunistically looking up the
commit via the commit-graph, if available, which gives us a slight speed
bump of about 2% in a huge repository with about 2.3M refs:

    Benchmark #1: HEAD~: git-fetch
      Time (mean ± σ):     31.634 s ±  0.258 s    [User: 28.400 s, System: 5.090 s]
      Range (min … max):   31.280 s … 31.896 s    5 runs

    Benchmark #2: HEAD: git-fetch
      Time (mean ± σ):     31.129 s ±  0.543 s    [User: 27.976 s, System: 5.056 s]
      Range (min … max):   30.172 s … 31.479 s    5 runs

    Summary
      'HEAD: git-fetch' ran
        1.02 ± 0.02 times faster than 'HEAD~: git-fetch'

In case this fails, we fall back to the old code which peels the
objects to a commit.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
