]> git.ipfire.org Git - thirdparty/git.git/commit
odb/source-inmemory: convert to use oidtree
authorPatrick Steinhardt <ps@pks.im>
Fri, 10 Apr 2026 12:12:40 +0000 (14:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 May 2026 19:50:45 +0000 (04:50 +0900)
commitc04907694601556de0ce862ad4f80fc55ec38c62
tree18368669d6f8ca512526c0fa57b72878b1483d97
parent449650decf49b1fe5b1dac1c48dfb919e9b57b0d
odb/source-inmemory: convert to use oidtree

The in-memory source stores its objects in a simple array that we grow as
needed. This has a couple of downsides:

  - The object lookup is O(n). This doesn't matter in practice because
    we only store a small number of objects.

  - We don't have an easy way to iterate over all objects in
    lexicographic order.

  - We don't have an easy way to compute unique object ID prefixes.

Refactor the code to use an oidtree instead. This is the same data
structure used by our loose object source, and thus it means we get a
bunch of functionality for free.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
odb/source-inmemory.c
odb/source-inmemory.h