<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/commit-reach.c, branch main</title>
<subtitle>Fork of git SCM with my patches.</subtitle>
<id>http://git.kilabit.info/git/atom?h=main</id>
<link rel='self' href='http://git.kilabit.info/git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/'/>
<updated>2026-03-19T17:45:41Z</updated>
<entry>
<title>commit-reach: simplify cleanup of remaining bitmaps in ahead_behind ()</title>
<updated>2026-03-19T17:45:41Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2026-03-19T16:24:40Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=60d8b5af9b553230faaae4fd276398d4f9fe4e39'/>
<id>urn:sha1:60d8b5af9b553230faaae4fd276398d4f9fe4e39</id>
<content type='text'>
Don't bother extracting the last few remaining prio_queue items in
order when we only want to free their associated bitmaps; just iterate
over the item array.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit: rename `free_commit_list()` to conform to coding guidelines</title>
<updated>2026-01-15T13:32:31Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2026-01-15T09:35:34Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=9f18d089c51fba2776fe1fece877a359c47417f7'/>
<id>urn:sha1:9f18d089c51fba2776fe1fece877a359c47417f7</id>
<content type='text'>
Our coding guidelines say that:

  Functions that operate on `struct S` are named `S_&lt;verb&gt;()` and should
  generally receive a pointer to `struct S` as first parameter.

While most of the functions related to `struct commit_list` already
follow that naming schema, `free_commit_list()` doesn't.

Rename the function to address this and adjust all of its callers. Add a
compatibility wrapper for the old function name to ease the transition
and avoid any semantic conflicts with in-flight patch series. This
wrapper will be removed once Git 2.53 has been released.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: use commit_stack</title>
<updated>2025-12-24T23:29:29Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-12-24T17:03:27Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=0e445956f4c9b6d079feb5ed831f018c857b955b'/>
<id>urn:sha1:0e445956f4c9b6d079feb5ed831f018c857b955b</id>
<content type='text'>
Use commit_stack instead of open-coding it.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: avoid commit_list_insert_by_date()</title>
<updated>2025-10-24T17:13:17Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2025-10-24T16:47:10Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=134ec330d2945002d0ceb7de2ac6cd7ab0af762d'/>
<id>urn:sha1:134ec330d2945002d0ceb7de2ac6cd7ab0af762d</id>
<content type='text'>
Building a list using commit_list_insert_by_date() has quadratic worst
case complexity.  Avoid it by just appending in the loop and sorting at
the end.

The number of merge bases is usually small, so don't expect speedups in
normal repositories.  It has no limit, though.  The added perf test
shows a nice improvement when dealing with 16384 merge bases:

Test                     v2.51.1           HEAD
-----------------------------------------------------------------
6010.2: git merge-base   0.55(0.54+0.00)   0.03(0.02+0.00) -94.5%

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: use `size_t` to track indices when computing merge bases</title>
<updated>2024-12-27T16:12:40Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-27T10:46:29Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=5e7fe8a7b89a07d8c3ab298ac69bc33f6ba88b47'/>
<id>urn:sha1:5e7fe8a7b89a07d8c3ab298ac69bc33f6ba88b47</id>
<content type='text'>
The functions `repo_get_merge_bases_many()` and friends accepts an array
of commits as well as a parameter that indicates how large that array
is. This parameter is using a signed integer, which leads to a couple of
warnings with -Wsign-compare.

Refactor the code to use `size_t` to track indices instead and adapt
callers accordingly. While most callers are trivial, there are two
callers that require a bit more scrutiny:

  - builtin/merge-base.c:show_merge_base() subtracts `1` from the
    `rev_nr` before calling `repo_get_merge_bases_many_dirty()`, so if
    the variable was `0` it would wrap. This code is fine though because
    its only caller will execute that code only when `argc &gt;= 2`, and it
    follows that `rev_nr &gt;= 2`, as well.

  - bisect.ccheck_merge_bases() similarly subtracts `1` from `rev_nr`.
    Again, there is only a single caller that populates `rev_nr` with
    `good_revs.nr`. And because a bisection always requires at least one
    good revision it follws that `rev_nr &gt;= 1`.

Mark the file as -Wsign-compare-clean.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: use `size_t` to track indices in `get_reachable_subset()`</title>
<updated>2024-12-27T16:11:45Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-27T10:46:25Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=85ee0680e2d5d667919e06394ca7622f09652310'/>
<id>urn:sha1:85ee0680e2d5d667919e06394ca7622f09652310</id>
<content type='text'>
Similar as with the preceding commit, adapt `get_reachable_subset()` so
that it tracks array indices via `size_t` instead of using signed
integers to fix a couple of -Wsign-compare warnings. Adapt callers
accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: use `size_t` to track indices in `remove_redundant()`</title>
<updated>2024-12-27T16:11:45Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-27T10:46:24Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=45843d8f4eb2bbfc73cc361ba9d612d088dc8a4f'/>
<id>urn:sha1:45843d8f4eb2bbfc73cc361ba9d612d088dc8a4f</id>
<content type='text'>
The function `remove_redundant()` gets as input an array of commits as
well as the size of that array and then drops redundant commits from
that array. It then returns either `-1` in case an error occurred, or
the new number of items in the array.

The function receives and returns these sizes with a signed integer,
which causes several warnings with -Wsign-compare. Fix this issue by
consistently using `size_t` to track array indices and splitting up
the returned value into a returned error code and a separate out pointer
for the new computed size.

Note that `get_merge_bases_many()` and related functions still track
array sizes as a signed integer. This will be fixed in a subsequent
commit.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: fix type of `min_commit_date`</title>
<updated>2024-12-27T16:11:45Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-27T10:46:23Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=04aeeeaab1f02213703c4e1997b2c2f1ca0f8f96'/>
<id>urn:sha1:04aeeeaab1f02213703c4e1997b2c2f1ca0f8f96</id>
<content type='text'>
The `can_all_from_reach_with_flag()` function accepts a parameter that
allows callers to cut off traversal at a specified commit date. This
parameter is of type `time_t`, which is a signed type, while we end up
comparing it to a commit's `date` field, which is of the unsigned type
`timestamp_t`.

Fix the parameter to be of type `timestamp_t`. There is only a single
caller in "upload-pack.c" that sets this parameter, and that caller
knows to pass in a `timestamp_t` already.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>commit-reach: fix index used to loop through unsigned integer</title>
<updated>2024-12-27T16:11:15Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-27T10:46:22Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=95c09e4d07492fa9e4ad951a268b4ea6bae69038'/>
<id>urn:sha1:95c09e4d07492fa9e4ad951a268b4ea6bae69038</id>
<content type='text'>
In 62e745ced2 (prio-queue: use size_t rather than int for size,
2024-12-20), we refactored `struct prio_queue` to track the number of
contained entries via a `size_t`. While the refactoring adapted one of
the users of that variable, it forgot to also adapt "commit-reach.c"
accordingly. This was missed because that file has -Wsign-conversion
disabled.

Fix the issue by using a `size_t` to iterate through entries.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>global: mark code units that generate warnings with `-Wsign-compare`</title>
<updated>2024-12-06T11:20:02Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-12-06T10:27:19Z</published>
<link rel='alternate' type='text/html' href='http://git.kilabit.info/git/commit/?id=41f43b8243f42b9df2e98be8460646d4c0100ad3'/>
<id>urn:sha1:41f43b8243f42b9df2e98be8460646d4c0100ad3</id>
<content type='text'>
Mark code units that generate warnings with `-Wsign-compare`. This
allows for a structured approach to get rid of all such warnings over
time in a way that can be easily measured.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
