ocaml-git: native Git.Fetch.fetch_local for file:// URLs
Pure-OCaml object-graph walk + copy between two on-disk repos. No git
subprocess, no zlib re-compression — file:// fetches in monopam tests
and the local-checkout daily flow now go through ocaml-git directly.
Architecture: pure core / Eio shell. Git.Fetch.reachable_from is a pure
DFS over the (commit, tree, blob, tag) reachability graph parameterised
on read/exists callbacks; Git.Fetch.fetch_local is the I/O wrapper that
opens repos, walks, copies, and writes FETCH_HEAD + refs/remotes/origin.
Wired into monopam/lib/git_cli.ml: fetch_url now switches on parse_url
and routes file:// (and bare local paths) through fetch_local. HTTP/SSH
URLs still shell out to git fetch. The added ~sw parameter threads the
Eio switch to keep Repository handles bounded.
Drive-by fixes uncovered by the new path:
- Repository.write_ref: use Eio.Path.mkdirs so refs/remotes/origin/<b>
works (mkdir only creates one level and crashed on the nested path)
- git_cli.open_local: detect bare vs non-bare repos by probing .git/
Tests: 11 new cases in ocaml-git/test/test_fetch.ml covering parse_url,
reachable_from order/incremental skip, and fetch_local basic/incremental
/unknown-ref. All ocaml-git + monopam suites pass.