<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/packfile.h, 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-10-15T05:29:03Z</updated>
<entry>
<title>fuzz: add fuzz testing for packfile indices.</title>
<updated>2018-10-15T05:29:03Z</updated>
<author>
<name>Josh Steadmon</name>
<email>steadmon@google.com</email>
</author>
<published>2018-10-13T00:58:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1127a98ccea2a911d2043dcc9ce301e080a3cc39'/>
<id>urn:sha1:1127a98ccea2a911d2043dcc9ce301e080a3cc39</id>
<content type='text'>
Breaks the majority of check_packed_git_idx() into a separate function,
load_idx(). The latter function operates on arbitrary buffers, which
makes it suitable as a fuzzing test target.

Signed-off-by: Josh Steadmon &lt;steadmon@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>packfile: add all_packs list</title>
<updated>2018-08-20T22:31:40Z</updated>
<author>
<name>Derrick Stolee</name>
<email>dstolee@microsoft.com</email>
</author>
<published>2018-08-20T16:52:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0bff5269d3ed7124259bb3a5b33ddf2c4080b7e7'/>
<id>urn:sha1:0bff5269d3ed7124259bb3a5b33ddf2c4080b7e7</id>
<content type='text'>
If a repo contains a multi-pack-index, then the packed_git list
does not contain the packfiles that are covered by the multi-pack-index.
This is important for doing object lookups, abbreviations, and
approximating object count. However, there are many operations that
really want to iterate over all packfiles.

Create a new 'all_packs' linked list that contains this list, starting
with the packfiles in the multi-pack-index and then continuing along
the packed_git linked list.

Signed-off-by: Derrick Stolee &lt;dstolee@microsoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Sync 'ds/multi-pack-index' to v2.19.0-rc0</title>
<updated>2018-08-20T22:29:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-20T22:29:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8'/>
<id>urn:sha1:c00ba2233ef7dcfa478068c75bc4b25a7ac2a0a8</id>
<content type='text'>
* ds/multi-pack-index: (23 commits)
  midx: clear midx on repack
  packfile: skip loading index if in multi-pack-index
  midx: prevent duplicate packfile loads
  midx: use midx in approximate_object_count
  midx: use existing midx when writing new one
  midx: use midx in abbreviation calculations
  midx: read objects from multi-pack-index
  config: create core.multiPackIndex setting
  midx: write object offsets
  midx: write object id fanout chunk
  midx: write object ids in a chunk
  midx: sort and deduplicate objects from packfiles
  midx: read pack names into array
  multi-pack-index: write pack names in chunk
  multi-pack-index: read packfile list
  packfile: generalize pack directory list
  t5319: expand test data
  multi-pack-index: load into memory
  midx: write header information to lockfile
  multi-pack-index: add 'write' verb
  ...
</content>
</entry>
<entry>
<title>Merge branch 'jk/for-each-object-iteration'</title>
<updated>2018-08-20T18:33:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-20T18:33:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0c54cdaf6580f121919048633e85772d60b8fb17'/>
<id>urn:sha1:0c54cdaf6580f121919048633e85772d60b8fb17</id>
<content type='text'>
The API to iterate over all objects learned to optionally list
objects in the order they appear in packfiles, which helps locality
of access if the caller accesses these objects while as objects are
enumerated.

* jk/for-each-object-iteration:
  for_each_*_object: move declarations to object-store.h
  cat-file: use a single strbuf for all output
  cat-file: split batch "buf" into two variables
  cat-file: use oidset check-and-insert
  cat-file: support "unordered" output for --batch-all-objects
  cat-file: rename batch_{loose,packed}_object callbacks
  t1006: test cat-file --batch-all-objects with duplicates
  for_each_packed_object: support iterating in pack-order
  for_each_*_object: give more comprehensive docstrings
  for_each_*_object: take flag arguments as enum
  for_each_*_object: store flag definitions in a single location
</content>
</entry>
<entry>
<title>for_each_*_object: move declarations to object-store.h</title>
<updated>2018-08-14T19:29:57Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-14T18:21:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0889aae1cd18c1804ba01c1a4229e516dfb9fe9b'/>
<id>urn:sha1:0889aae1cd18c1804ba01c1a4229e516dfb9fe9b</id>
<content type='text'>
The for_each_loose_object() and for_each_packed_object()
functions are meant to be part of a unified interface: they
use the same set of for_each_object_flags, and it's not
inconceivable that we might one day add a single
for_each_object() wrapper around them.

Let's put them together in a single file, so we can avoid
awkwardness like saying "the flags for this function are
over in cache.h". Moving the loose functions to packfile.h
is silly. Moving the packed functions to cache.h works, but
makes the "cache.h is a kitchen sink" problem worse. The
best place is the recently-created object-store.h, since
these are quite obviously related to object storage.

The for_each_*_in_objdir() functions do not use the same
flags, but they are logically part of the same interface as
for_each_loose_object(), and share callback signatures. So
we'll move those, as well, as they also make sense in
object-store.h.

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>for_each_packed_object: support iterating in pack-order</title>
<updated>2018-08-13T20:48:28Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-10T23:15:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=736eb88fdc8a2dea4302114d2f74b580d0f83cfe'/>
<id>urn:sha1:736eb88fdc8a2dea4302114d2f74b580d0f83cfe</id>
<content type='text'>
We currently iterate over objects within a pack in .idx
order, which uses the object hashes. That means that it
is effectively random with respect to the location of the
object within the pack. If you're going to access the actual
object data, there are two reasons to move linearly through
the pack itself:

  1. It improves the locality of access in the packfile. In
     the cold-cache case, this may mean fewer disk seeks, or
     better usage of disk cache.

  2. We store related deltas together in the packfile. Which
     means that the delta base cache can operate much more
     efficiently if we visit all of those related deltas in
     sequence, as the earlier items are likely to still be
     in the cache.  Whereas if we visit the objects in
     random order, our cache entries are much more likely to
     have been evicted by unrelated deltas in the meantime.

So in general, if you're going to access the object contents
pack order is generally going to end up more efficient.

But if you're simply generating a list of object names, or
if you're going to end up sorting the result anyway, you're
better off just using the .idx order, as finding the pack
order means generating the in-memory pack-revindex.
According to the numbers in 8b8dfd5132 (pack-revindex:
radix-sort the revindex, 2013-07-11), that takes about 200ms
for linux.git, and 20ms for git.git (those numbers are a few
years old but are still a good ballpark).

That makes it a good optimization for some cases (we can
save tens of seconds in git.git by having good locality of
delta access, for a 20ms cost), but a bad one for others
(e.g., right now "cat-file --batch-all-objects
--batch-check="%(objectname)" is 170ms in git.git, so adding
20ms to that is noticeable).

Hence this patch makes it an optional flag. You can't
actually do any interesting timings yet, as it's not plumbed
through to any user-facing tools like cat-file. That will
come in a later patch.

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>for_each_*_object: give more comprehensive docstrings</title>
<updated>2018-08-13T20:48:26Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-10T23:11:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8b361551900be9bedd946386362f2d0e2a506845'/>
<id>urn:sha1:8b361551900be9bedd946386362f2d0e2a506845</id>
<content type='text'>
We already mention the local/alternate behavior of these
functions, but we can help clarify a few other behaviors:

 - there's no need to mention LOCAL_ONLY specifically, since
   we already reference the flags by type (and as we add
   more flags, we don't want to have to mention each)

 - clarify that reachability doesn't matter here; this is
   all accessible objects

 - what ordering/uniqueness guarantees we give

 - how pack-specific flags are handled for the loose case

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>for_each_*_object: take flag arguments as enum</title>
<updated>2018-08-13T20:48:25Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-10T23:09:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7ff6f5a0f310406aa4973e8d7ec25815554bcb5'/>
<id>urn:sha1:a7ff6f5a0f310406aa4973e8d7ec25815554bcb5</id>
<content type='text'>
It's not wrong to pass our flags in an "unsigned", as we
know it will be at least as large as the enum.  However,
using the enum in the declaration makes it more obvious
where to find the list of flags.

While we're here, let's also drop the "extern" noise-words
from the declarations, per our modern coding style.

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>for_each_*_object: store flag definitions in a single location</title>
<updated>2018-08-13T20:47:50Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-08-10T23:09:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=202e7f1e161b5bce6587d1a696843ead10a8b477'/>
<id>urn:sha1:202e7f1e161b5bce6587d1a696843ead10a8b477</id>
<content type='text'>
These flags were split between cache.h and packfile.h,
because some of the flags apply only to packs. However, they
share a single numeric namespace, since both are respected
for the packed variant. Let's make sure they're defined
together so that nobody accidentally adds a new flag in one
location that duplicates the other.

While we're here, let's also put them in an enum (which
helps debugger visibility) and use "(1&lt;&lt;n)" rather than
counting powers of 2 manually.

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>packfile: ensure that enum object_type is defined</title>
<updated>2018-07-26T17:36:26Z</updated>
<author>
<name>Beat Bolli</name>
<email>dev+git@drbeat.li</email>
</author>
<published>2018-07-25T21:56:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b42f98af096bfdf90339def75fe969b9d969b0f6'/>
<id>urn:sha1:b42f98af096bfdf90339def75fe969b9d969b0f6</id>
<content type='text'>
When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with
"make DEVELOPER=1 DEVOPTS=pedantic", the compiler says

    error: redeclaration of already-defined enum 'object_type' is a GNU
    extension [-Werror,-Wgnu-redeclared-enum]

According to https://en.cppreference.com/w/c/language/declarations
(section "Redeclaration"), a repeated declaration after the definition
is only legal for structs and unions, but not for enums.

Drop the belated declaration of enum object_type and include cache.h
instead to make sure the enum is defined.

Helped-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Beat Bolli &lt;dev+git@drbeat.li&gt;
Reviewed-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
