<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/pack-objects.c, branch v2.23.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.23.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.23.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-06-20T17:44:22Z</updated>
<entry>
<title>hashmap: convert sha1hash() to oidhash()</title>
<updated>2019-06-20T17:44:22Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-06-20T07:41:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d40abc8e95f75b529feb140178b69a3783c2d108'/>
<id>urn:sha1:d40abc8e95f75b529feb140178b69a3783c2d108</id>
<content type='text'>
There are no callers left of sha1hash() that do not simply pass the
"hash" member of a "struct object_id". Let's get rid of the outdated
sha1-specific function and provide one that operates on the whole struct
(even though the technique, taking the first few bytes of the hash, will
remain the same).

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: convert locate_object_entry_hash() to object_id</title>
<updated>2019-06-20T17:03:32Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-06-20T07:41:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5e7ac6802823ec23759b1b986315bd65b0881ff9'/>
<id>urn:sha1:5e7ac6802823ec23759b1b986315bd65b0881ff9</id>
<content type='text'>
There are no callers of locate_object_entry_hash() that aren't just
passing us the "hash" member of a "struct object_id". Let's take the
whole struct, which gets us closer to removing all raw sha1 variables.

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: convert packlist_find() to use object_id</title>
<updated>2019-06-20T16:54:58Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-06-20T07:41:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3df28caefb2193fb7bbc87a427a620d96d508c8d'/>
<id>urn:sha1:3df28caefb2193fb7bbc87a427a620d96d508c8d</id>
<content type='text'>
We take a raw hash pointer, but most of our callers have a "struct
object_id" already. Let's switch to taking the full struct, which will
let us continue removing uses of raw sha1 buffers.

There are two callers that do need special attention:

  - in rebuild_existing_bitmaps(), we need to switch to
    nth_packed_object_oid(). This incurs an extra hash copy over
    pointing straight to the mmap'd sha1, but it shouldn't be measurable
    compared to the rest of the operation.

  - in can_reuse_delta() we already spent the effort to copy the sha1
    into a "struct object_id", but now we just have to do so a little
    earlier in the function (we can't easily convert that function's
    callers because they may be pointing at mmap'd REF_DELTA blocks).

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: drop unused parameter from oe_map_new_pack()</title>
<updated>2019-02-14T23:26:15Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2019-02-14T05:50:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c409d108b857799ae699654d2fc33b063c9aef9d'/>
<id>urn:sha1:c409d108b857799ae699654d2fc33b063c9aef9d</id>
<content type='text'>
Since 43fa44fa3b (pack-objects: move in_pack out of struct object_entry,
2018-04-14), we store the source pack for each object as a small index
rather than as a pointer. When we see a new pack that has no allocated
index, we fall back to generating an array of pointers by calling
oe_map_new_pack().

Perhaps counter-intuitively, that function does not need to actually see
our new index-less pack. It only allocates and populates the array with
the existing packs, after which oe_set_in_pack() actually adds the new
pack to the array.

Let's drop the unused "struct packed_git" argument to oe_map_new_pack()
to avoid confusion.

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 'ph/pack-objects-mutex-fix'</title>
<updated>2019-02-05T22:26:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-02-05T22:26:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=d243a323a545da68b87149e885f2e440f0b13725'/>
<id>urn:sha1:d243a323a545da68b87149e885f2e440f0b13725</id>
<content type='text'>
"git pack-objects" incorrectly used uninitialized mutex, which has
been corrected.

* ph/pack-objects-mutex-fix:
  pack-objects: merge read_lock and lock in packing_data struct
  pack-objects: move read mutex to packing_data struct
</content>
</entry>
<entry>
<title>pack-objects: merge read_lock and lock in packing_data struct</title>
<updated>2019-01-28T19:22:12Z</updated>
<author>
<name>Patrick Hogg</name>
<email>phogg@novamoon.net</email>
</author>
<published>2019-01-25T00:22:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=edb673cf1001eeff140370c41139aaa06e67cea0'/>
<id>urn:sha1:edb673cf1001eeff140370c41139aaa06e67cea0</id>
<content type='text'>
Rename the packing_data lock to obd_lock and upgrade it to a recursive
mutex to make it suitable for current read_lock usages. Additionally
remove the superfluous #ifndef NO_PTHREADS guard around mutex
initialization in prepare_packing_data as the mutex functions
themselves are already protected.

Signed-off-by: Patrick Hogg &lt;phogg@novamoon.net&gt;
Helped-by: Junio C Hamano &lt;gitster@pobox.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pack-objects: move read mutex to packing_data struct</title>
<updated>2019-01-28T19:22:06Z</updated>
<author>
<name>Patrick Hogg</name>
<email>phogg@novamoon.net</email>
</author>
<published>2019-01-25T00:22:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=459307b139c9a859ca0b6ca5276cf9be3d2b8e3e'/>
<id>urn:sha1:459307b139c9a859ca0b6ca5276cf9be3d2b8e3e</id>
<content type='text'>
ac77d0c37 ("pack-objects: shrink size field in struct object_entry",
2018-04-14) added an extra usage of read_lock/read_unlock in the newly
introduced oe_get_size_slow for thread safety in parallel calls to
try_delta(). Unfortunately oe_get_size_slow is also used in serial
code, some of which is called before the first invocation of
ll_find_deltas. As such the read mutex is not guaranteed to be
initialized.

Resolve this by moving the read mutex to packing_data and initializing
it in prepare_packing_data which is initialized in cmd_pack_objects.

Signed-off-by: Patrick Hogg &lt;phogg@novamoon.net&gt;
Reviewed-by: Duy Nguyen &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pack-*.c: remove the_repository references</title>
<updated>2018-11-12T05:50:06Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2018-11-10T05:49:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c14112741b81366cfbbc3b98e0b92422fcce83d'/>
<id>urn:sha1:7c14112741b81366cfbbc3b98e0b92422fcce83d</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 (mingw): initialize `packing_data` mutex in the correct spot</title>
<updated>2018-10-19T05:28:44Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2018-10-16T21:02:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34204c81668324480e1f34a09cce9c21fabf4b40'/>
<id>urn:sha1:34204c81668324480e1f34a09cce9c21fabf4b40</id>
<content type='text'>
In 9ac3f0e5b3e4 (pack-objects: fix performance issues on packing large
deltas, 2018-07-22), a mutex was introduced that is used to guard the
call to set the delta size. This commit even added code to initialize
it, but at an incorrect spot: in `init_threaded_search()`, while the
call to `oe_set_delta_size()` (and hence to `packing_data_lock()`) can
happen in the call chain `check_object()` &lt;- `get_object_details()` &lt;-
`prepare_pack()` &lt;- `cmd_pack_objects()`, which is long before the
`prepare_pack()` function calls `ll_find_deltas()` (which initializes
the threaded search).

Another tell-tale that the mutex was initialized in an incorrect spot is
that the function to initialize it lives in builtin/, while the code
that uses the mutex is defined in a libgit.a header file.

Let's use a more appropriate function: `prepare_packing_data()`, which
not only lives in libgit.a, but *has* to be called before the
`packing_data` struct is used that contains that mutex.

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

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
