odb: add write_packfile, for_each_unique_abbrev, convert_object_id#2074
Open
MayCXC wants to merge 1 commit intogitgitgadget:masterfrom
Open
odb: add write_packfile, for_each_unique_abbrev, convert_object_id#2074MayCXC wants to merge 1 commit intogitgitgadget:masterfrom
MayCXC wants to merge 1 commit intogitgitgadget:masterfrom
Conversation
|
There is an issue in commit 3d511c2:
|
785108f to
146c7ed
Compare
Author
|
/submit |
|
Submitted as pull.2074.git.1774530437562.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
6e569fc to
5b3e9a8
Compare
Author
|
/submit |
|
Submitted as pull.2074.v2.git.1774532383055.gitgitgadget@gmail.com To fetch this version into To fetch this version to local tag |
47c9431 to
729b6f2
Compare
Add three vtable methods to odb_source that were not part of the recent ps/odb-sources and ps/object-counting series: - write_packfile: ingest a pack from a file descriptor. The files backend chooses between index-pack (large packs) and unpack-objects (small packs below fetch.unpackLimit). Options cover thin-pack fixing, promisor marking, fsck, lockfile capture, and shallow file passing. - for_each_unique_abbrev: iterate objects matching a hex prefix for disambiguation. Searches loose objects via oidtree, then multi-pack indices, then non-MIDX packs. - convert_object_id: translate between hash algorithms using the loose object map. Used during SHA-1 to SHA-256 migration. Also add ODB_SOURCE_HELPER to the source type enum, preparing for the helper backend in the next commit. The write_packfile vtable method replaces the pattern where callers spawn index-pack/unpack-objects directly. fast-import already uses odb_write_packfile() and this allows non-files backends to handle pack ingestion through their own mechanism. Signed-off-by: Aaron Paterson <apaterson@pm.me>
729b6f2 to
a69b8d3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds three ODB source vtable methods that were not part of the
recent ps/odb-sources and ps/object-counting series, plus caller
routing for object-name.c and fast-import.c.
New vtable methods:
write_packfile: Ingest a pack from a file descriptor. The files
backend chooses between index-pack (large packs) and
unpack-objects (small packs below fetch.unpackLimit). Options
cover thin-pack fixing, promisor marking, fsck, lockfile capture,
and shallow file passing. Non-files backends can handle pack
ingestion through their own mechanism.
for_each_unique_abbrev: Iterate objects matching a hex prefix for
disambiguation. The files backend searches loose objects via
oidtree, multi-pack indices, then non-MIDX packs.
convert_object_id: Translate between hash algorithms using the
loose object map. Used during SHA-1 to SHA-256 migration.
Caller routing:
object-name.c: The abbreviation and disambiguation paths
(find_short_object_filename, find_abbrev_len_packed, and
find_short_packed_object) directly access files-backend internals
(loose cache, pack store, MIDX). These are converted to dispatch
through the for_each_unique_abbrev vtable method, so that
non-files backends participate through proper abstraction rather
than being skipped.
fast-import.c: end_packfile() replaced direct pack indexing,
registration, and odb_source_files_downcast() with a call to
odb_write_packfile(). gfi_unpack_entry() falls back to
odb_read_object() when the pack slot is NULL (non-files backends
ingest packs without registering them on disk).
This addresses Patrick's feedback on the previous submission [1]:
the correct fix for downcast sites is proper vtable abstraction, not
skipping non-files backends.
Additional:
repository.h
Motivation: These methods are needed by the local helper backend
series [2], which delegates object and reference storage
to external git-local- helper processes. sqlite-git [3] is a
working proof of concept that stores objects, refs, and reflogs
in a single SQLite database with full worktree support.
CC: Junio C Hamano gitster@pobox.com, Patrick Steinhardt ps@pks.im
[1] https://github.com/gitgitgadget/git/pull/2068.patch
[2] https://github.com/gitgitgadget/git/compare/master...MayCXC:git:ps/series-2-helpers-v3.patch
[3] https://github.com/MayCXC/sqlite-git