diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-09-23 12:17:10 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-09-24 11:53:50 -0700 |
| commit | d67530f6bbe56f1951b8fd2fcdaae255bf552e2d (patch) | |
| tree | 1f26edfb6f83c3b97496ab46f4a025a69c4fc089 /builtin/fast-import.c | |
| parent | f6f236d926915411eca28cb1c47619fdacf6eafb (diff) | |
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>
Diffstat (limited to 'builtin/fast-import.c')
| -rw-r--r-- | builtin/fast-import.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c index e9d82b31c3..a26e79689d 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -897,11 +897,11 @@ static void end_packfile(void) idx_name = keep_pack(create_index()); /* Register the packfile with core git's machinery. */ - new_p = add_packed_git(pack_data->repo, idx_name, strlen(idx_name), 1); + new_p = packfile_store_load_pack(pack_data->repo->objects->packfiles, + idx_name, 1); if (!new_p) die("core git rejected index %s", idx_name); all_packs[pack_id] = new_p; - packfile_store_add_pack(the_repository->objects->packfiles, new_p); free(idx_name); /* Print the boundary */ |
