<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pack-objects.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-11-21T11:39:02Z</updated>
<entry>
<title>Merge branch 'cc/delta-islands'</title>
<updated>2018-11-21T11:39:02Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-21T11:39:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7fab474656cdb5517d5b627602a54776e485ddbc'/>
<id>urn:sha1:7fab474656cdb5517d5b627602a54776e485ddbc</id>
<content type='text'>
A few issues in the implementation of "delta-islands" feature has
been corrected.

* cc/delta-islands:
  pack-objects: fix off-by-one in delta-island tree-depth computation
  pack-objects: zero-initialize tree_depth/layer arrays
  pack-objects: fix tree_depth and layer invariants
</content>
</entry>
<entry>
<title>pack-objects: zero-initialize tree_depth/layer arrays</title>
<updated>2018-11-21T04:50:27Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-20T09:48:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e159b8107190aa53b27f9f106e5874597106eb88'/>
<id>urn:sha1:e159b8107190aa53b27f9f106e5874597106eb88</id>
<content type='text'>
Commit 108f530385 (pack-objects: move tree_depth into 'struct
packing_data', 2018-08-16) started maintaining a tree_depth array that
matches the "objects" array. We extend the array when:

  1. The objects array is extended, in which case we use realloc to
     extend the tree_depth array.

  2. A caller asks to store a tree_depth for object N, and this is the
     first such request; we create the array from scratch and store the
     value for N.

In the latter case, though, we use regular xmalloc(), and the depth
values for any objects besides N is undefined. This happens to not
trigger a bug with the current code, but the reasons are quite subtle:

 - we never ask about the depth for any object with index i &lt; N. This is
   because we store the depth immediately for all trees and blobs. So
   any such "i" must be a non-tree, and therefore we will never need to
   care about its depth (in fact, we really only care about the depth of
   trees).

 - there are no objects at this point with index i &gt; N, because we
   always fill in the depth for a tree immediately after its object
   entry is created (we may still allocate uninitialized depth entries,
   but they'll be initialized by packlist_alloc() when it initializes
   the entry in the "objects" array).

So it works, but only by chance. To be defensive, let's zero the array,
which matches the "unset" values which would be handed out by
oe_tree_depth() already.

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>pack-objects: fix tree_depth and layer invariants</title>
<updated>2018-11-21T04:50:16Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-11-20T09:46:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bc35ac1a6a844fc3484833afee41260e1d47042e'/>
<id>urn:sha1:bc35ac1a6a844fc3484833afee41260e1d47042e</id>
<content type='text'>
Commit 108f530385 (pack-objects: move tree_depth into 'struct
packing_data', 2018-08-16) dynamically manages a tree_depth array in
packing_data that maintains one of these invariants:

  1. tree_depth is NULL (i.e., the requested options don't require us to
     track tree depths)

  2. tree_depth is non-NULL and has as many entries as the "objects"
     array

We maintain (2) by:

  a. When the objects array grows, grow tree_depth to the same size
     (unless it's NULL, in which case we can leave it).

  b. When a caller asks to set a depth via oe_set_tree_depth(), if
     tree_depth is NULL we allocate it.

But in (b), we use the number of stored objects, _not_ the allocated
size of the objects array. So we can run into a situation like this:

  1. packlist_alloc() needs to store the Nth object, so it grows the
     objects array to M, where M &gt; N.

  2. oe_set_tree_depth() wants to store a depth, so it allocates an
     array of length N. Now we've violated our invariant.

  3. packlist_alloc() needs to store the N+1th object. But it _doesn't_
     grow the objects array, since N &lt;= M still holds. We try to assign
     to tree_depth[N+1], which is out of bounds.

That doesn't happen in our test scripts, because the repositories they
use are so small, but it's easy to trigger by running:

  echo HEAD | git pack-objects --revs --delta-islands --stdout &gt;/dev/null

in any reasonably-sized repo (like git.git).

We can fix it by always growing the array to match pack-&gt;nr_alloc, not
pack-&gt;nr_objects. Likewise for the "layer" array from fe0ac2fb7f
(pack-objects: move 'layer' into 'struct packing_data', 2018-08-16),
which has the same bug.

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/pthreads'</title>
<updated>2018-11-18T09:23:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-11-18T09:23:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=26b80a841ad6f2ddff855aa9bd0000a4ba81f6ff'/>
<id>urn:sha1:26b80a841ad6f2ddff855aa9bd0000a4ba81f6ff</id>
<content type='text'>
The codebase has been cleaned up to reduce "#ifndef NO_PTHREADS".

* nd/pthreads:
  Clean up pthread_create() error handling
  read-cache.c: initialize copy_len to shut up gcc 8
  read-cache.c: reduce branching based on HAVE_THREADS
  read-cache.c: remove #ifdef NO_PTHREADS
  pack-objects: remove #ifdef NO_PTHREADS
  preload-index.c: remove #ifdef NO_PTHREADS
  grep: clean up num_threads handling
  grep: remove #ifdef NO_PTHREADS
  attr.c: remove #ifdef NO_PTHREADS
  name-hash.c: remove #ifdef NO_PTHREADS
  index-pack: remove #ifdef NO_PTHREADS
  send-pack.c: move async's #ifdef NO_PTHREADS back to run-command.c
  run-command.h: include thread-utils.h instead of pthread.h
  thread-utils: macros to unconditionally compile pthreads API
</content>
</entry>
<entry>
<title>pack-objects: remove #ifdef NO_PTHREADS</title>
<updated>2018-11-05T04:42:11Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-11-03T08:48:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9c897c5c2ad27d82b47472c967f675cad122aed3'/>
<id>urn:sha1:9c897c5c2ad27d82b47472c967f675cad122aed3</id>
<content type='text'>
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>Merge branch 'js/pack-objects-mutex-init-fix'</title>
<updated>2018-10-30T06:43:43Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-10-30T06:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=620b00e1671a8b4c1b00dbea8a0e81a657f28ce1'/>
<id>urn:sha1:620b00e1671a8b4c1b00dbea8a0e81a657f28ce1</id>
<content type='text'>
A mutex used in "git pack-objects" were not correctly initialized
and this caused "git repack" to dump core on Windows.

* js/pack-objects-mutex-init-fix:
  pack-objects (mingw): initialize `packing_data` mutex in the correct spot
  pack-objects (mingw): demonstrate a segmentation fault with large deltas
  pack-objects: fix typo 'detla' -&gt; 'delta'
</content>
</entry>
<entry>
<title>pack-objects: fix typo 'detla' -&gt; 'delta'</title>
<updated>2018-10-19T05:28:15Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-10-16T21:02:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce498e094e8db32fff358ecf7e4ad4951e6bebce'/>
<id>urn:sha1:ce498e094e8db32fff358ecf7e4ad4951e6bebce</id>
<content type='text'>
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>Merge branch 'cc/delta-islands'</title>
<updated>2018-09-17T20:53:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-09-17T20:53:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f3504ea3dd21b0a6d38bcd369efa0663cdc05416'/>
<id>urn:sha1:f3504ea3dd21b0a6d38bcd369efa0663cdc05416</id>
<content type='text'>
Lift code from GitHub to restrict delta computation so that an
object that exists in one fork is not made into a delta against
another object that does not appear in the same forked repository.

* cc/delta-islands:
  pack-objects: move 'layer' into 'struct packing_data'
  pack-objects: move tree_depth into 'struct packing_data'
  t5320: tests for delta islands
  repack: add delta-islands support
  pack-objects: add delta-islands support
  pack-objects: refactor code into compute_layer_order()
  Add delta-islands.{c,h}
</content>
</entry>
<entry>
<title>Merge branch 'jk/pack-delta-reuse-with-bitmap'</title>
<updated>2018-09-17T20:53:53Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-09-17T20:53:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ebdef2e1b4c89fd193140b36c04b41eb7f9a86d'/>
<id>urn:sha1:3ebdef2e1b4c89fd193140b36c04b41eb7f9a86d</id>
<content type='text'>
When creating a thin pack, which allows objects to be made into a
delta against another object that is not in the resulting pack but
is known to be present on the receiving end, the code learned to
take advantage of the reachability bitmap; this allows the server
to send a delta against a base beyond the "boundary" commit.

* jk/pack-delta-reuse-with-bitmap:
  pack-objects: reuse on-disk deltas for thin "have" objects
  pack-bitmap: save "have" bitmap from walk
  t/perf: add perf tests for fetches from a bitmapped server
  t/perf: add infrastructure for measuring sizes
  t/perf: factor out percent calculations
  t/perf: factor boilerplate out of test_perf
</content>
</entry>
<entry>
<title>Merge branch 'nd/pack-deltify-regression-fix'</title>
<updated>2018-08-22T18:17:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-08-22T18:17:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29d9e3e2c47dd4b5053b0a98c891878d398463e3'/>
<id>urn:sha1:29d9e3e2c47dd4b5053b0a98c891878d398463e3</id>
<content type='text'>
In a recent update in 2.18 era, "git pack-objects" started
producing a larger than necessary packfiles by missing
opportunities to use large deltas.

* nd/pack-deltify-regression-fix:
  pack-objects: fix performance issues on packing large deltas
</content>
</entry>
</feed>
