<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/pack-objects.c, branch v2.32.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.32.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.32.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2021-05-27T03:36:58Z</updated>
<entry>
<title>Merge branch 'ab/pack-linkage-fix'</title>
<updated>2021-05-27T03:36:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-27T03:36:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5afd72a96f0a3f65a832fd1448d9de1c534aaa69'/>
<id>urn:sha1:5afd72a96f0a3f65a832fd1448d9de1c534aaa69</id>
<content type='text'>
"ld" on Solaris fails to link some test helpers, which has been
worked around by reshuffling the inline function definitions from a
header file to a source file that is the only user of them.

* ab/pack-linkage-fix:
  pack-objects: move static inline from a header to the sole consumer
</content>
</entry>
<entry>
<title>pack-objects: move static inline from a header to the sole consumer</title>
<updated>2021-05-27T03:14:41Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-05-27T00:52:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7d089fb9b73a0d7f9bf43a81f284fd4f499d4886'/>
<id>urn:sha1:7d089fb9b73a0d7f9bf43a81f284fd4f499d4886</id>
<content type='text'>
Move the code that is only used in builtin/pack-objects.c out of
pack-objects.h.

This fixes an issue where Solaris's SunCC hasn't been able to compile
git since 483fa7f42d9 (t/helper/test-bitmap.c: initial commit,
2021-03-31).

The real origin of that issue is that in 898eba5e630 (pack-objects:
refer to delta objects by index instead of pointer, 2018-04-14)
utility functions only needed by builtin/pack-objects.c were added to
pack-objects.h. Since then the header has been used in a few other
places, but 483fa7f42d9 was the first time it was used by test helper.

Since Solaris is stricter about linking and the oe_get_size_slow()
function lives in builtin/pack-objects.c the build started failing
with:

    Undefined                       first referenced
     symbol                             in file
    oe_get_size_slow                    t/helper/test-bitmap.o
    ld: fatal: symbol referencing errors. No output written to t/helper/test-tool

On other platforms this is presumably OK because the compiler and/or
linker detects that the "static inline" functions that reference
oe_get_size_slow() aren't used.

Let's solve this by moving the relevant code from pack-objects.h to
builtin/pack-objects.c. This is almost entirely a code-only move, but
because of the early macro definitions in that file referencing some
of these inline functions we need to move the definition of "static
struct packing_data to_pack" earlier, and declare these inline
functions above the macros.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/pack-objects-negative-options-fix'</title>
<updated>2021-05-11T06:27:23Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-11T06:27:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1af57f5d321aeb95dbdbe48bdb2b0e1e37528323'/>
<id>urn:sha1:1af57f5d321aeb95dbdbe48bdb2b0e1e37528323</id>
<content type='text'>
Options to "git pack-objects" that take numeric values like
--window and --depth should not accept negative values; the input
validation has been tightened.

* jk/pack-objects-negative-options-fix:
  pack-objects: clamp negative depth to 0
  t5316: check behavior of pack-objects --depth=0
  pack-objects: clamp negative window size to 0
  t5300: check that we produced expected number of deltas
  t5300: modernize basic tests
</content>
</entry>
<entry>
<title>Merge branch 'rs/repack-without-loosening-promised-objects'</title>
<updated>2021-05-10T07:59:47Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-10T07:59:47Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a0f521b56c724f4e21eef1cec2d456b1dbd72c10'/>
<id>urn:sha1:a0f521b56c724f4e21eef1cec2d456b1dbd72c10</id>
<content type='text'>
"git repack -A -d" in a partial clone unnecessarily loosened
objects in promisor pack.

* rs/repack-without-loosening-promised-objects:
  repack: avoid loosening promisor objects in partial clones
</content>
</entry>
<entry>
<title>Merge branch 'bc/hash-transition-interop-part-1'</title>
<updated>2021-05-10T07:59:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-10T07:59:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aaa3c8065d86e8f25850eb79e90da68d6adcf03f'/>
<id>urn:sha1:aaa3c8065d86e8f25850eb79e90da68d6adcf03f</id>
<content type='text'>
SHA-256 transition.

* bc/hash-transition-interop-part-1:
  hex: print objects using the hash algorithm member
  hex: default to the_hash_algo on zero algorithm value
  builtin/pack-objects: avoid using struct object_id for pack hash
  commit-graph: don't store file hashes as struct object_id
  builtin/show-index: set the algorithm for object IDs
  hash: provide per-algorithm null OIDs
  hash: set, copy, and use algo field in struct object_id
  builtin/pack-redundant: avoid casting buffers to struct object_id
  Use the final_oid_fn to finalize hashing of object IDs
  hash: add a function to finalize object IDs
  http-push: set algorithm when reading object ID
  Always use oidread to read into struct object_id
  hash: add an algo member to struct object_id
</content>
</entry>
<entry>
<title>Merge branch 'ps/rev-list-object-type-filter'</title>
<updated>2021-05-07T03:47:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-05-07T03:47:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8585d6c04aa903526b4b3554e90d6381ec62390a'/>
<id>urn:sha1:8585d6c04aa903526b4b3554e90d6381ec62390a</id>
<content type='text'>
"git rev-list" learns the "--filter=object:type=&lt;type&gt;" option,
which can be used to exclude objects of the given kind from the
packfile generated by pack-objects.

* ps/rev-list-object-type-filter:
  rev-list: allow filtering of provided items
  pack-bitmap: implement combined filter
  pack-bitmap: implement object type filter
  list-objects: implement object type filter
  list-objects: support filtering by tag and commit
  list-objects: move tag processing into its own function
  revision: mark commit parents as NOT_USER_GIVEN
  uploadpack.txt: document implication of `uploadpackfilter.allow`
</content>
</entry>
<entry>
<title>pack-objects: clamp negative depth to 0</title>
<updated>2021-05-03T05:30:46Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-05-01T14:04:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6d52b6a5dfe0bee20dbfb2a3a7291bcf9a152672'/>
<id>urn:sha1:6d52b6a5dfe0bee20dbfb2a3a7291bcf9a152672</id>
<content type='text'>
A negative delta depth makes no sense, and the code is not prepared to
handle it. If passed "--depth=-1" on the command line, then this line
from break_delta_chains():

	cur-&gt;depth = (total_depth--) % (depth + 1);

triggers a divide-by-zero. This is undefined behavior according to the C
standard, but on POSIX systems results in SIGFPE killing the process.
This is certainly one way to inform the use that the command was
invalid, but it's a bit friendlier to just treat it as "don't allow any
deltas", which we already do for --depth=0.

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: clamp negative window size to 0</title>
<updated>2021-05-03T05:29:27Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2021-05-01T14:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=953aa54e1a6a7571d48eddea3ee68745bf94e69d'/>
<id>urn:sha1:953aa54e1a6a7571d48eddea3ee68745bf94e69d</id>
<content type='text'>
A negative window size makes no sense, and the code in find_deltas() is
not prepared to handle it. If you pass "-1", for example, we end up
generate a 0-length array of "struct unpacked", but our loop assumes it
has at least one entry in it (and we end up reading garbage memory).

We could complain to the user about this, but it's more forgiving to
just clamp it to 0, which means "do not find any deltas at all". The
0-case is already tested earlier in the script, so we'll make sure this
does the same thing.

Reported-by: Yiyuan guo &lt;yguoaz@gmail.com&gt;
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/promisor-optim'</title>
<updated>2021-04-30T04:50:24Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2021-04-30T04:50:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=13158b9910f8de4a88b39420be80f03c681b3ec9'/>
<id>urn:sha1:13158b9910f8de4a88b39420be80f03c681b3ec9</id>
<content type='text'>
Handling of "promisor packs" that allows certain objects to be
missing and lazily retrievable has been optimized (a bit).

* jk/promisor-optim:
  revision: avoid parsing with --exclude-promisor-objects
  lookup_unknown_object(): take a repository argument
  is_promisor_object(): free tree buffer after parsing
</content>
</entry>
<entry>
<title>repack: avoid loosening promisor objects in partial clones</title>
<updated>2021-04-28T04:36:13Z</updated>
<author>
<name>Rafael Silva</name>
<email>rafaeloliveira.cs@gmail.com</email>
</author>
<published>2021-04-21T19:32:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a643157d5ac8dddcbf9bfd4fbbd1af914fbb1378'/>
<id>urn:sha1:a643157d5ac8dddcbf9bfd4fbbd1af914fbb1378</id>
<content type='text'>
When `git repack -A -d` is run in a partial clone, `pack-objects`
is invoked twice: once to repack all promisor objects, and once to
repack all non-promisor objects. The latter `pack-objects` invocation
is with --exclude-promisor-objects and --unpack-unreachable, which
loosens all objects unused during this invocation. Unfortunately,
this includes promisor objects.

Because the -d argument to `git repack` subsequently deletes all loose
objects also in packs, these just-loosened promisor objects will be
immediately deleted. However, this extra disk churn is unnecessary in
the first place.  For example, in a newly-cloned partial repo that
filters all blob objects (e.g. `--filter=blob:none`), `repack` ends up
unpacking all trees and commits into the filesystem because every
object, in this particular case, is a promisor object. Depending on
the repo size, this increases the disk usage considerably: In my copy
of the linux.git, the object directory peaked 26GB of more disk usage.

In order to avoid this extra disk churn, pass the names of the promisor
packfiles as --keep-pack arguments to the second invocation of
`pack-objects`. This informs `pack-objects` that the promisor objects
are already in a safe packfile and, therefore, do not need to be
loosened.

For testing, we need to validate whether any object was loosened.
However, the "evidence" (loosened objects) is deleted during the
process which prevents us from inspecting the object directory.
Instead, let's teach `pack-objects` to count loosened objects and
emit via trace2 thus allowing inspecting the debug events after the
process is finished. This new event is used on the added regression
test.

Lastly, add a new perf test to evaluate the performance impact
made by this changes (tested on git.git):

     Test          HEAD^                 HEAD
     ----------------------------------------------------------
     5600.3: gc    134.38(41.93+90.95)   7.80(6.72+1.35) -94.2%

For a bigger repository, such as linux.git, the improvement is
even bigger:

     Test          HEAD^                     HEAD
     -------------------------------------------------------------------
     5600.3: gc    6833.00(918.07+3162.74)   268.79(227.02+39.18) -96.1%

These improvements are particular big because every object in the
newly-cloned partial repository is a promisor object.

Reported-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Helped-by: Jeff King &lt;peff@peff.net&gt;
Helped-by: Jonathan Tan &lt;jonathantanmy@google.com&gt;
Signed-off-by: Rafael Silva &lt;rafaeloliveira.cs@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
