]> git.ipfire.org Git - thirdparty/git.git/commit
midx: build `keep_hashes` array in order
authorTaylor Blau <me@ttaylorr.com>
Tue, 19 May 2026 15:57:45 +0000 (11:57 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 20 May 2026 02:31:13 +0000 (11:31 +0900)
commit3a5ebfac2f8910f335dc1f269e8a8cbdcacb7157
tree3d5c9e4ed6772ff6c9ec80d1c4dab1f4ce264b07
parentddaa7a6fb79038a30b59341ed3f0f2097014ccbf
midx: build `keep_hashes` array in order

Instead of filling the keep_hashes array using reverse indexing (e.g.,
`keep_hashes[count - i - 1]`) while traversing linked lists forward,
collect linked list nodes into a temporary `layers` array and then
iterate it backwards to fill `keep_hashes` sequentially.

This makes the filling logic easier to follow, since each segment of the
array is filled with a simple forward-marching index. Moreover, this
change prepares us for a subsequent commit that will switch to using a
`strvec`.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
midx-write.c