]> git.ipfire.org Git - thirdparty/git.git/commit
odb: introduce "in-memory" source
authorPatrick Steinhardt <ps@pks.im>
Fri, 10 Apr 2026 12:12:31 +0000 (14:12 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 May 2026 19:50:44 +0000 (04:50 +0900)
commit822d403651aa6baff064095f98d8d8349d876eb8
treeaf09a09d8bbd9f09375e41a43bfacd43bf2a1ae4
parent2f124686e85efe25006e485588000d576f0c0b4f
odb: introduce "in-memory" source

Next to our typical object database sources, each object database also
has an implicit source of "cached" objects. These cached objects only
exist in memory and some use cases:

  - They contain evergreen objects that we expect to always exist, like
    for example the empty tree.

  - They can be used to store temporary objects that we don't want to
    persist to disk, which is used by git-blame(1) to create a fake
    worktree commit.

Overall, their use is somewhat restricted though. For example, we don't
provide the ability to use it as a temporary object database source that
allows the user to write objects, but discard them after Git exists. So
while these cached objects behave almost like a source, they aren't used
as one.

This is about to change over the following commits, where we will turn
cached objects into a new "in-memory" source. This will allow us to use
it exactly the same as any other source by providing the same common
interface as the "files" source.

For now, the in-memory source only hosts the cached objects and doesn't
provide any logic yet. This will change with subsequent commits, where
we move respective functionality into the source.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
meson.build
odb.c
odb.h
odb/source-inmemory.c [new file with mode: 0644]
odb/source-inmemory.h [new file with mode: 0644]
odb/source.h