diff options
| author | Kristofer Karlsson <krka@spotify.com> | 2026-08-11 09:28:49 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-08-11 07:34:32 -0700 |
| commit | a3e5bad734f8f83a485c5f28535d1f409993a175 (patch) | |
| tree | ba138d503a4b9deaa25f544dbe3663eabe6dceb6 /gitweb/gitweb.css | |
| parent | bad379346dd81bff1238557aa6dc06254b4f4701 (diff) | |
commit-reach: introduce struct paint_state with per-side counters
Add a paint_state struct for use by paint_down_to_common() that
wraps a prio_queue with per-side commit counters. Each non-stale
queued commit occupies exactly one counter bucket based on its
paint flags: PARENT1-only, PARENT2-only, or both sides (a pending
merge-base candidate).
The counters are maintained by paint_count_update() which adjusts
the appropriate bucket by a signed delta. An exhaustive switch on
the paint+stale bits documents all valid flag combinations in one
place.
Convert paint_down_to_common() to use paint_state. The loop now
drains the queue via paint_queue_get() which returns NULL when all
counters reach zero, replacing the old pointer-based termination
(max_nonstale). This is equivalent behavior -- both conditions
detect that no non-stale entries remain.
paint_queue_get() uses a "pop first" form: it dequeues a commit,
then checks the counters. This means the loop exits one iteration
earlier than the old code in some topologies (the popped stale
commit is never processed), so a few step counts drop by one.
The existing nonstale_queue is left in place for ahead_behind(),
though nonstale_queue_put_dedup() and nonstale_queue_get_dedup()
become unused and are removed.
Signed-off-by: Kristofer Karlsson <krka@spotify.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb/gitweb.css')
0 files changed, 0 insertions, 0 deletions
