<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/fetch.c, branch v2.10.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.10.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.10.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-10-28T16:01:17Z</updated>
<entry>
<title>Merge branch 'jk/fetch-quick-tag-following' into maint</title>
<updated>2016-10-28T16:01:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-10-28T16:01:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=39000e849970a554a257577dcb2fb844a523a1d1'/>
<id>urn:sha1:39000e849970a554a257577dcb2fb844a523a1d1</id>
<content type='text'>
When fetching from a remote that has many tags that are irrelevant
to branches we are following, we used to waste way too many cycles
when checking if the object pointed at by a tag (that we are not
going to fetch!) exists in our repository too carefully.

* jk/fetch-quick-tag-following:
  fetch: use "quick" has_sha1_file for tag following
</content>
</entry>
<entry>
<title>fetch: use "quick" has_sha1_file for tag following</title>
<updated>2016-10-14T18:31:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-10-13T16:53:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5827a03545663f6d6b491a35edb313900608568b'/>
<id>urn:sha1:5827a03545663f6d6b491a35edb313900608568b</id>
<content type='text'>
When we auto-follow tags in a fetch, we look at all of the
tags advertised by the remote and fetch ones where we don't
already have the tag, but we do have the object it peels to.
This involves a lot of calls to has_sha1_file(), some of
which we can reasonably expect to fail. Since 45e8a74
(has_sha1_file: re-check pack directory before giving up,
2013-08-30), this may cause many calls to
reprepare_packed_git(), which is potentially expensive.

This has gone unnoticed for several years because it
requires a fairly unique setup to matter:

  1. You need to have a lot of packs on the client side to
     make reprepare_packed_git() expensive (the most
     expensive part is finding duplicates in an unsorted
     list, which is currently quadratic).

  2. You need a large number of tag refs on the server side
     that are candidates for auto-following (i.e., that the
     client doesn't have). Each one triggers a re-read of
     the pack directory.

  3. Under normal circumstances, the client would
     auto-follow those tags and after one large fetch, (2)
     would no longer be true. But if those tags point to
     history which is disconnected from what the client
     otherwise fetches, then it will never auto-follow, and
     those candidates will impact it on every fetch.

So when all three are true, each fetch pays an extra
O(nr_tags * nr_packs^2) cost, mostly in string comparisons
on the pack names. This was exacerbated by 47bf4b0
(prepare_packed_git_one: refactor duplicate-pack check,
2014-06-30) which uses a slightly more expensive string
check, under the assumption that the duplicate check doesn't
happen very often (and it shouldn't; the real problem here
is how often we are calling reprepare_packed_git()).

This patch teaches fetch to use HAS_SHA1_QUICK to sacrifice
accuracy for speed, in cases where we might be racy with a
simultaneous repack. This is similar to the fix in 0eeb077
(index-pack: avoid excessive re-reading of pack directory,
2015-06-09). As with that case, it's OK for has_sha1_file()
occasionally say "no I don't have it" when we do, because
the worst case is not a corruption, but simply that we may
fail to auto-follow a tag that points to it.

Here are results from the included perf script, which sets
up a situation similar to the one described above:

Test            HEAD^               HEAD
----------------------------------------------------------
5550.4: fetch   11.21(10.42+0.78)   0.08(0.04+0.02) -99.3%

Reported-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
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>Merge branch 'jk/push-progress'</title>
<updated>2016-08-03T22:10:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-08-03T22:10:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a58a8e3f7156dadd5d5e9643168545ff057c111a'/>
<id>urn:sha1:a58a8e3f7156dadd5d5e9643168545ff057c111a</id>
<content type='text'>
"git push" and "git clone" learned to give better progress meters
to the end user who is waiting on the terminal.

* jk/push-progress:
  receive-pack: send keepalives during quiet periods
  receive-pack: turn on connectivity progress
  receive-pack: relay connectivity errors to sideband
  receive-pack: turn on index-pack resolving progress
  index-pack: add flag for showing delta-resolution progress
  clone: use a real progress meter for connectivity check
  check_connected: add progress flag
  check_connected: relay errors to alternate descriptor
  check_everything_connected: use a struct with named options
  check_everything_connected: convert to argv_array
  rev-list: add optional progress reporting
  check_everything_connected: always pass --quiet to rev-list
</content>
</entry>
<entry>
<title>Merge branch 'mh/ref-iterators'</title>
<updated>2016-07-25T21:13:33Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-07-25T21:13:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=87492cb24d9d8be8e18217b89ae5f090089ff31d'/>
<id>urn:sha1:87492cb24d9d8be8e18217b89ae5f090089ff31d</id>
<content type='text'>
The API to iterate over all the refs (i.e. for_each_ref(), etc.)
has been revamped.

* mh/ref-iterators:
  for_each_reflog(): reimplement using iterators
  dir_iterator: new API for iterating over a directory tree
  for_each_reflog(): don't abort for bad references
  do_for_each_ref(): reimplement using reference iteration
  refs: introduce an iterator interface
  ref_resolves_to_object(): new function
  entry_resolves_to_object(): rename function from ref_resolves_to_object()
  get_ref_cache(): only create an instance if there is a submodule
  remote rm: handle symbolic refs correctly
  delete_refs(): add a flags argument
  refs: use name "prefix" consistently
  do_for_each_ref(): move docstring to the header file
  refs: remove unnecessary "extern" keywords
</content>
</entry>
<entry>
<title>check_everything_connected: use a struct with named options</title>
<updated>2016-07-20T19:10:53Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-07-15T10:30:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7043c7071cdbdef60ce8413f425da622b8e6dc85'/>
<id>urn:sha1:7043c7071cdbdef60ce8413f425da622b8e6dc85</id>
<content type='text'>
The number of variants of check_everything_connected has
grown over the years, so that the "real" function takes
several possibly-zero, possibly-NULL arguments. We hid the
complexity behind some wrapper functions, but this doesn't
scale well when we want to add new options.

If we add more wrapper variants to handle the new options,
then we can get a combinatorial explosion when those options
might be used together (right now nobody wants to use both
"shallow" and "transport" together, so we get by with just a
few wrappers).

If instead we add new parameters to each function, each of
which can have a default value, then callers who want the
defaults end up with confusing invocations like:

  check_everything_connected(fn, 0, data, -1, 0, NULL);

where it is unclear which parameter is which (and every
caller needs updated when we add new options).

Instead, let's add a struct to hold all of the optional
parameters. This is a little more verbose for the callers
(who have to declare the struct and fill it in), but it
makes their code much easier to follow, because every option
is named as it is set (and unused options do not have to be
mentioned at all).

Note that we could also stick the iteration function and its
callback data into the option struct, too. But since those
are required for each call, by avoiding doing so, we can let
very simple callers just pass "NULL" for the options and not
worry about the struct at all.

While we're touching each site, let's also rename the
function to check_connected(). The existing name was quite
long, and not all of the wrappers even used the full name.

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>Merge branch 'nd/fetch-ref-summary'</title>
<updated>2016-07-19T20:22:21Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-07-19T20:22:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=566fdaf611f44724120412a43132c07b020fc4f1'/>
<id>urn:sha1:566fdaf611f44724120412a43132c07b020fc4f1</id>
<content type='text'>
Improve the look of the way "git fetch" reports what happened to
each ref that was fetched.

* nd/fetch-ref-summary:
  fetch: reduce duplicate in ref update status lines with placeholder
  fetch: align all "remote -&gt; local" output
  fetch: change flag code for displaying tag update and deleted ref
  fetch: refactor ref update status formatting code
  git-fetch.txt: document fetch output
</content>
</entry>
<entry>
<title>Merge branch 'km/fetch-do-not-free-remote-name' into maint</title>
<updated>2016-07-11T17:44:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-07-11T17:44:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1401236842d871e3a40d5c40e7914b6ef8908899'/>
<id>urn:sha1:1401236842d871e3a40d5c40e7914b6ef8908899</id>
<content type='text'>
The ownership rule for the piece of memory that hold references to
be fetched in "git fetch" was screwy, which has been cleaned up.

* km/fetch-do-not-free-remote-name:
  builtin/fetch.c: don't free remote-&gt;name after fetch
</content>
</entry>
<entry>
<title>Merge branch 'km/fetch-do-not-free-remote-name'</title>
<updated>2016-07-06T20:38:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-07-06T20:38:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=845351c99b0ae6ed96d1acb56dbf0e668c9abd9c'/>
<id>urn:sha1:845351c99b0ae6ed96d1acb56dbf0e668c9abd9c</id>
<content type='text'>
The ownership rule for the piece of memory that hold references to
be fetched in "git fetch" was screwy, which has been cleaned up.

* km/fetch-do-not-free-remote-name:
  builtin/fetch.c: don't free remote-&gt;name after fetch
</content>
</entry>
<entry>
<title>fetch: reduce duplicate in ref update status lines with placeholder</title>
<updated>2016-07-06T18:48:25Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-07-01T16:03:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc437d10202c015a5733f706dc44fa6bbf4d85b9'/>
<id>urn:sha1:bc437d10202c015a5733f706dc44fa6bbf4d85b9</id>
<content type='text'>
In the "remote -&gt; local" line, if either ref is a substring of the
other, the common part in the other string is replaced with "*". For
example

    abc                -&gt; origin/abc
    refs/pull/123/head -&gt; pull/123

become

    abc         -&gt; origin/*
    refs/*/head -&gt; pull/123

Activated with fetch.output=compact.

For the record, this output is not perfect. A single giant ref can
push all refs very far to the right and likely be wrapped around. We
may have a few options:

 - exclude these long lines smarter

 - break the line after "-&gt;", exclude it from column width calculation

 - implement a new format, { -&gt; origin/}foo, which makes the problem
   go away at the cost of a bit harder to read

 - reverse all the arrows so we have "* &lt;- looong-ref", again still
   hard to read.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>fetch: align all "remote -&gt; local" output</title>
<updated>2016-07-06T18:48:25Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-07-01T16:03:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6bc91f23a6e14d540ab6950b438d40cf678143f0'/>
<id>urn:sha1:6bc91f23a6e14d540ab6950b438d40cf678143f0</id>
<content type='text'>
We do align "remote -&gt; local" output by allocating 10 columns to
"remote". That produces aligned output only for short refs. An extra
pass is performed to find the longest remote ref name (that does not
produce a line longer than terminal width) to produce better aligned
output.

Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
