]> git.ipfire.org Git - thirdparty/git.git/commit
packfile: introduce function to load and add packfiles
authorPatrick Steinhardt <ps@pks.im>
Tue, 23 Sep 2025 10:17:10 +0000 (12:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Sep 2025 18:53:50 +0000 (11:53 -0700)
commitd67530f6bbe56f1951b8fd2fcdaae255bf552e2d
tree1f26edfb6f83c3b97496ab46f4a025a69c4fc089
parentf6f236d926915411eca28cb1c47619fdacf6eafb
packfile: introduce function to load and add packfiles

We have a recurring pattern where we essentially perform an upsert of a
packfile in case it isn't yet known by the packfile store. The logic to
do so is non-trivial as we have to reconstruct the packfile's key, check
the map of packfiles, then create the new packfile and finally add it to
the store.

Introduce a new function that does this dance for us. Refactor callsites
to use it.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fast-import.c
builtin/index-pack.c
midx.c
packfile.c
packfile.h