<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/reachable.c, branch v2.7.4</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.7.4</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.7.4'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2016-03-16T17:42:02Z</updated>
<entry>
<title>Merge branch 'jk/path-name-safety-2.5' into jk/path-name-safety-2.6</title>
<updated>2016-03-16T17:42:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-03-16T17:42:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=717e3551b9fbfdb72e40a81fc0fb714cdaadb37f'/>
<id>urn:sha1:717e3551b9fbfdb72e40a81fc0fb714cdaadb37f</id>
<content type='text'>
* jk/path-name-safety-2.5:
  list-objects: pass full pathname to callbacks
  list-objects: drop name_path entirely
  list-objects: convert name_path to a strbuf
  show_object_with_name: simplify by using path_name()
  http-push: stop using name_path
  tree-diff: catch integer overflow in combine_diff_path allocation
  add helpers for detecting size_t overflow
</content>
</entry>
<entry>
<title>Merge branch 'jk/path-name-safety-2.4' into jk/path-name-safety-2.5</title>
<updated>2016-03-16T17:41:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-03-16T17:41:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=253ce7a15c251057464b130016c74cbe10fe9e57'/>
<id>urn:sha1:253ce7a15c251057464b130016c74cbe10fe9e57</id>
<content type='text'>
* jk/path-name-safety-2.4:
  list-objects: pass full pathname to callbacks
  list-objects: drop name_path entirely
  list-objects: convert name_path to a strbuf
  show_object_with_name: simplify by using path_name()
  http-push: stop using name_path
  tree-diff: catch integer overflow in combine_diff_path allocation
  add helpers for detecting size_t overflow
</content>
</entry>
<entry>
<title>list-objects: pass full pathname to callbacks</title>
<updated>2016-03-16T17:41:04Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-11T22:28:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2824e1841b99393d2469c495253d547c643bd8f1'/>
<id>urn:sha1:2824e1841b99393d2469c495253d547c643bd8f1</id>
<content type='text'>
When we find a blob at "a/b/c", we currently pass this to
our show_object_fn callbacks as two components: "a/b/" and
"c". Callbacks which want the full value then call
path_name(), which concatenates the two. But this is an
inefficient interface; the path is a strbuf, and we could
simply append "c" to it temporarily, then roll back the
length, without creating a new copy.

So we could improve this by teaching the callsites of
path_name() this trick (and there are only 3). But we can
also notice that no callback actually cares about the
broken-down representation, and simply pass each callback
the full path "a/b/c" as a string. The callback code becomes
even simpler, then, as we do not have to worry about freeing
an allocated buffer, nor rolling back our modification to
the strbuf.

This is theoretically less efficient, as some callbacks
would not bother to format the final path component. But in
practice this is not measurable. Since we use the same
strbuf over and over, our work to grow it is amortized, and
we really only pay to memcpy a few bytes.

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>list-objects: drop name_path entirely</title>
<updated>2016-03-16T17:41:03Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2016-02-11T22:26:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dc06dc880013d48f2b09c6b4295419382f3b8230'/>
<id>urn:sha1:dc06dc880013d48f2b09c6b4295419382f3b8230</id>
<content type='text'>
In the previous commit, we left name_path as a thin wrapper
around a strbuf. This patch drops it entirely. As a result,
every show_object_fn callback needs to be adjusted. However,
none of their code needs to be changed at all, because the
only use was to pass it to path_name(), which now handles
the bare strbuf.

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 'js/gc-with-stale-symref' into maint</title>
<updated>2015-10-20T22:22:42Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-10-20T22:22:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b05c2f9ed48adfd9670b28ecdd5c55a4e4698704'/>
<id>urn:sha1:b05c2f9ed48adfd9670b28ecdd5c55a4e4698704</id>
<content type='text'>
"git gc" used to barf when a symbolic ref has gone dangling
(e.g. the branch that used to be your upstream's default when you
cloned from it is now gone, and you did "fetch --prune").

* js/gc-with-stale-symref:
  pack-objects: do not get distracted by broken symrefs
  gc: demonstrate failure with stale remote HEAD
</content>
</entry>
<entry>
<title>pack-objects: do not get distracted by broken symrefs</title>
<updated>2015-10-08T19:42:06Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2015-09-28T14:01:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=14886b40c552d3ad4d5492d922948d76762af198'/>
<id>urn:sha1:14886b40c552d3ad4d5492d922948d76762af198</id>
<content type='text'>
It is quite possible for, say, a remote HEAD to become broken, e.g.
when the default branch was renamed.

We should still be able to pack our objects when such a thing happens;
simply ignore broken symrefs (because they cannot matter for the packing
process anyway).

This fixes https://github.com/git-for-windows/git/issues/423

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add_one_ref(): rewrite to take an object_id argument</title>
<updated>2015-05-25T19:19:34Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2015-05-25T18:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=635170f2bb34116441b562a93d3ce37ae4373ecc'/>
<id>urn:sha1:635170f2bb34116441b562a93d3ce37ae4373ecc</id>
<content type='text'>
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>each_ref_fn: change to take an object_id parameter</title>
<updated>2015-05-25T19:19:27Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2015-05-25T18:38:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2b2a5be394bc67bed86bc009195c664dca740bd6'/>
<id>urn:sha1:2b2a5be394bc67bed86bc009195c664dca740bd6</id>
<content type='text'>
Change typedef each_ref_fn to take a "const struct object_id *oid"
parameter instead of "const unsigned char *sha1".

To aid this transition, implement an adapter that can be used to wrap
old-style functions matching the old typedef, which is now called
"each_ref_sha1_fn"), and make such functions callable via the new
interface. This requires the old function and its cb_data to be
wrapped in a "struct each_ref_fn_sha1_adapter", and that object to be
used as the cb_data for an adapter function, each_ref_fn_adapter().

This is an enormous diff, but most of it consists of simple,
mechanical changes to the sites that call any of the "for_each_ref"
family of functions. Subsequent to this change, the call sites can be
rewritten one by one to use the new interface.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>reachable: only mark local objects as recent</title>
<updated>2015-04-20T20:09:27Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-03-27T11:32:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1385bb7ba39128de0a5bc4ff6e8a5ad03fc49205'/>
<id>urn:sha1:1385bb7ba39128de0a5bc4ff6e8a5ad03fc49205</id>
<content type='text'>
When pruning and repacking a repository that has an
alternate object store configured, we may traverse a large
number of objects in the alternate. This serves no purpose,
and may be expensive to do. A longer explanation is below.

Commits d3038d2 and abcb865 taught prune and pack-objects
(respectively) to treat "recent" objects as tips for
reachability, so that we keep whole chunks of history. They
built on the object traversal in 660c889 (sha1_file: add
for_each iterators for loose and packed objects,
2014-10-15), which covers both local and alternate objects.

In both cases, covering alternate objects is unnecessary, as
both commands can only drop objects from the local
repository. In the case of prune, we traverse only the local
object directory. And in the case of repacking, while we may
or may not include local objects in our pack, we will never
reach into the alternate with "repack -d". The "-l" option
is only a question of whether we are migrating objects from
the alternate into our repository, or leaving them
untouched.

It is possible that we may drop an object that is depended
upon by another object in the alternate. For example,
imagine two repositories, A and B, with A pointing to B as
an alternate. Now imagine a commit that is in B which
references a tree that is only in A. Traversing from recent
objects in B might prevent A from dropping that tree. But
this case isn't worth covering. Repo B should take
responsibility for its own objects. It would never have had
the commit in the first place if it did not also have the
tree, and assuming it is using the same "keep recent chunks
of history" scheme, then it would itself keep the tree, as
well.

So checking the alternate objects is not worth doing, and
come with a significant performance impact. In both cases,
we skip any recent objects that have already been marked
SEEN (i.e., that we know are already reachable for prune, or
included in the pack for a repack). So there is a slight
waste of time in opening the alternate packs at all, only to
notice that we have already considered each object. But much
worse, the alternate repository may have a large number of
objects that are not reachable from the local repository at
all, and we end up adding them to the traversal.

We can fix this by considering only local unseen objects.

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>reachable: use revision machinery's --indexed-objects code</title>
<updated>2014-10-19T22:07:07Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-10-17T00:44:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1be111d88f526130dcf3b7c7ad0f5df17c6d2bae'/>
<id>urn:sha1:1be111d88f526130dcf3b7c7ad0f5df17c6d2bae</id>
<content type='text'>
This does the same thing as our custom code, so let's not
repeat ourselves.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
