sx-git extension: git-wire import — the inverse adapter, round-trip law (TDD)

lib/git/import.sx parses loose payloads back to native objects bottom-up
over an export-set table: tree mode/name/raw-sha triples, ident lines,
header/message split, committer stored only when distinct so export
defaults regenerate identical bytes. Laws verified: export->import->export
is BYTE-IDENTICAL (head sha + every object), imported blobs/default-mode
trees regain their original native cids, 100755/tags/distinct-committer/
multi-line messages all survive. 15/15, total 267/267.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 12:52:24 +00:00
parent e228d462eb
commit 2c9e8e4850
5 changed files with 426 additions and 5 deletions

View File

@@ -13,7 +13,7 @@ if [ ! -x "$SX_SERVER" ]; then
exit 1
fi
SUITES=(object ref dag worktree diff merge porcelain export)
SUITES=(object ref dag worktree diff merge porcelain export import)
OUT_JSON="lib/git/scoreboard.json"
OUT_MD="lib/git/scoreboard.md"
@@ -51,6 +51,7 @@ run_suite() {
(load "lib/git/porcelain.sx")
(load "lib/git/sha1.sx")
(load "lib/git/export.sx")
(load "lib/git/import.sx")
(epoch 2)
(eval "(define git-test-pass 0)")
(eval "(define git-test-fail 0)")