<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/cache.h, branch v2.4.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.4.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.4.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-05-26T20:49:25Z</updated>
<entry>
<title>Merge branch 'jc/hash-object' into maint</title>
<updated>2015-05-26T20:49:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-26T20:49:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1e6c8babf86d8564104e159ce46df069c882a5af'/>
<id>urn:sha1:1e6c8babf86d8564104e159ce46df069c882a5af</id>
<content type='text'>
"hash-object --literally" introduced in v2.2 was not prepared to
take a really long object type name.

* jc/hash-object:
  write_sha1_file(): do not use a separate sha1[] array
  t1007: add hash-object --literally tests
  hash-object --literally: fix buffer overrun with extra-long object type
  git-hash-object.txt: document --literally option
</content>
</entry>
<entry>
<title>Merge branch 'jk/prune-mtime' into maint</title>
<updated>2015-05-13T21:05:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-05-13T21:05:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ebb464f0cba9efcb5552fad02f452f09f68fc9b2'/>
<id>urn:sha1:ebb464f0cba9efcb5552fad02f452f09f68fc9b2</id>
<content type='text'>
Access to objects in repositories that borrow from another one on a
slow NFS server unnecessarily got more expensive due to recent code
becoming more cautious in a naive way not to lose objects to pruning.

* jk/prune-mtime:
  sha1_file: only freshen packs once per run
  sha1_file: freshen pack objects before loose
  reachable: only mark local objects as recent
</content>
</entry>
<entry>
<title>hash-object --literally: fix buffer overrun with extra-long object type</title>
<updated>2015-05-05T17:14:18Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2015-05-04T07:25:15Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0c3db67cc8137cebea5b1a9c3c7fc379ef8ffda6'/>
<id>urn:sha1:0c3db67cc8137cebea5b1a9c3c7fc379ef8ffda6</id>
<content type='text'>
"hash-object" learned in 5ba9a93 (hash-object: add --literally
option, 2014-09-11) to allow crafting a corrupt/broken object of
unknown type.

When the user-provided type is particularly long, however, it can
overflow the relatively small stack-based character array handed to
write_sha1_file_prepare() by hash_sha1_file() and write_sha1_file(),
leading to stack corruption (and crash).  Introduce a custom helper
to allow arbitrarily long typenames just for "hash-object --literally".

[jc: Eric's original used a strbuf in the more common codepaths, and
I rewrote it to avoid penalizing the non-literally code. Bugs are mine]

Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>sha1_file: only freshen packs once per run</title>
<updated>2015-04-20T20:09:40Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-04-20T19:55:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ee1c6c34ac64c1e10b17a50710ea7002b7e7241f'/>
<id>urn:sha1:ee1c6c34ac64c1e10b17a50710ea7002b7e7241f</id>
<content type='text'>
Since 33d4221 (write_sha1_file: freshen existing objects,
2014-10-15), we update the mtime of existing objects that we
would have written out (had they not existed). For the
common case in which many objects are packed, we may update
the mtime on a single packfile repeatedly. This can result
in a noticeable performance problem if calling utime() is
expensive (e.g., because your storage is on NFS).

We can fix this by keeping a per-pack flag that lets us
freshen only once per program invocation.

An alternative would be to keep the packed_git.mtime flag up
to date as we freshen, and freshen only once every N
seconds. In practice, it's not worth the complexity. We are
racing against prune expiration times here, which inherently
must be set to accomodate reasonable program running times
(because they really care about the time between an object
being written and it becoming referenced, and the latter is
typically the last step a program takes).

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: 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>Merge branch 'jc/report-path-error-to-dir'</title>
<updated>2015-03-26T18:57:13Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-26T18:57:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=574ee8ae8636ffad8146e0f8e648b866dad725e6'/>
<id>urn:sha1:574ee8ae8636ffad8146e0f8e648b866dad725e6</id>
<content type='text'>
Code clean-up.

* jc/report-path-error-to-dir:
  report_path_error(): move to dir.c
</content>
</entry>
<entry>
<title>Merge branch 'jk/prune-with-corrupt-refs'</title>
<updated>2015-03-25T19:54:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-25T19:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=05e816e37f4eb023a3606b2942192390566c6107'/>
<id>urn:sha1:05e816e37f4eb023a3606b2942192390566c6107</id>
<content type='text'>
"git prune" used to largely ignore broken refs when deciding which
objects are still being used, which could spread an existing small
damage and make it a larger one.

* jk/prune-with-corrupt-refs:
  refs.c: drop curate_packed_refs
  repack: turn on "ref paranoia" when doing a destructive repack
  prune: turn on ref_paranoia flag
  refs: introduce a "ref paranoia" flag
  t5312: test object deletion code paths in a corrupted repository
</content>
</entry>
<entry>
<title>report_path_error(): move to dir.c</title>
<updated>2015-03-24T21:12:10Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-24T21:12:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=777c55a61615837d4391facd75cf334b96635801'/>
<id>urn:sha1:777c55a61615837d4391facd75cf334b96635801</id>
<content type='text'>
The expected call sequence is for the caller to use match_pathspec()
repeatedly on a set of pathspecs, accumulating the "hits" in a
separate array, and then call this function to diagnose a pathspec
that never matched anything, as that can indicate a typo from the
command line, e.g. "git commit Maekfile".

Many builtin commands use this function from builtin/ls-files.c,
which is not a very healthy arrangement.  ls-files might have been
the first command to feel the need for such a helper, but the need
is shared by everybody who uses the "match and then report" pattern.

Move it to dir.c where match_pathspec() is defined.

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: introduce a "ref paranoia" flag</title>
<updated>2015-03-20T19:40:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-03-20T18:43:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=49672f26d9a3826a6a74c6ff4d2409b7b0c74495'/>
<id>urn:sha1:49672f26d9a3826a6a74c6ff4d2409b7b0c74495</id>
<content type='text'>
Most operations that iterate over refs are happy to ignore
broken cruft. However, some operations should be performed
with knowledge of these broken refs, because it is better
for the operation to choke on a missing object than it is to
silently pretend that the ref did not exist (e.g., if we are
computing the set of reachable tips in order to prune
objects).

These processes could just call for_each_rawref, except that
ref iteration is often hidden behind other interfaces. For
instance, for a destructive "repack -ad", we would have to
inform "pack-objects" that we are destructive, and then it
would in turn have to tell the revision code that our
"--all" should include broken refs.

It's much simpler to just set a global for "dangerous"
operations that includes broken refs in all iterations.

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/prune-mtime' into maint</title>
<updated>2015-03-05T21:13:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-03-05T21:13:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cbc8d6d8f8e858072faa2f8fd03d0f255fe0c288'/>
<id>urn:sha1:cbc8d6d8f8e858072faa2f8fd03d0f255fe0c288</id>
<content type='text'>
In v2.2.0, we broke "git prune" that runs in a repository that
borrows from an alternate object store.

* jk/prune-mtime:
  sha1_file: fix iterating loose alternate objects
  for_each_loose_file_in_objdir: take an optional strbuf path
</content>
</entry>
</feed>
