Artifact 9d644eebcef2688ad3ae97f1b1c914b12b13fa2948d31c67e1b3e74f7fec3dab:
- File
src/git_import.zig
— part of check-in
[dc0aa2f858]
at
2026-07-31 02:56:07
on branch sub-manifest
— git-import: translate a Git fast-export stream into a zit history
`zit import-git SOURCE DEST` reads a Git repository through `git fast- export` and builds a zit repository from it. The destination appears only after the export, artifact creation and publication have all completed, so a failure anywhere leaves no half-published repository behind; this is the first caller of the logstore artifact batch added earlier on this branch, which is what makes a check-in's blobs arrive as a unit.
Mode 160000 now parses as a gitlink instead of error.UnsupportedMode. That completes the split begun in the previous check-in: reporting what the stream said is the parser's job, and deciding that zit has no submodule concept is the importer's. The refusal still happens, but it now explains itself instead of failing as a parse error on input git legitimately emits.
Signed commits are refused by default rather than imported with the signature silently dropped. Fossil has no signature card, so importing one is a loss the operator should choose; --drop-signatures accepts it explicitly.
The sub-manifest parameter is analyzed, not guessed. Preflight measures the source's own name set and pins its measured optimum, and --submanifest-k overrides that only to match another repository's existing pin, which is what lets two repositories share sub-manifests by content address. On a 100,000 file corpus the analyzed value cuts the objective by roughly 3.4x against the fixed default it replaces.
Correctness is checked differentially against real Git rather than against fixtures we wrote: every materialized tree is compared to `git ls-tree` for the corresponding commit, refs and annotated tags are compared to the source, and both comparators now assert that a gitlink is absent rather than merely tolerating it, so the omission is a contract instead of an accident.
The rest is wiring. extras learns the import provenance names, root.zig exports the importer modules across the executable and library boundary, tidy and the CI step guard learn the new test roots and build steps, and the e2e help check learns that a verb spelled import_git in Zig is import-git on the command line. (user: dmestas, size: 1265) [annotate] [blame] [check-ins using]
const implementation = @import("git_import_impl.zig"); pub const TreeStore = implementation.TreeStore; pub const TreeFormat = implementation.TreeFormat; pub const RootView = implementation.RootView; pub const TreeCommand = implementation.TreeCommand; pub const BuildResult = implementation.BuildResult; pub const TreeError = implementation.TreeError; pub const LoadedBytes = implementation.LoadedBytes; pub const TreeStoreError = implementation.TreeStoreError; pub const Attribution = implementation.Attribution; pub const UserOptions = implementation.UserOptions; pub const WorkCounters = implementation.WorkCounters; pub const ResolvedOptions = implementation.ResolvedOptions; pub const resolveOptions = implementation.resolveOptions; pub const analyzeSubmanifestK = implementation.analyzeSubmanifestK; pub const modeFromGit = implementation.modeFromGit; pub const CommitMarkState = implementation.CommitMarkState; pub const FinalizeOptions = implementation.FinalizeOptions; pub const FinalizedRef = implementation.FinalizedRef; pub const FinalizedRefs = implementation.FinalizedRefs; /// Production imports always use the incremental tree writer. pub const Importer = implementation.Importer(implementation.IncrementalTreePolicy, implementation.NoopObserver);