Monorepo management for opam overlays
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(ocaml-git): bridge gap commits in subtree split and self-heal cache

Subtree split produced orphaned commits (no parents) when the monorepo
history contained "gap" commits — commits with empty trees or only a
single subtree's content. These break the parent chain for all other
prefixes, causing non-fast-forward push failures for every package.

- Add find_ancestor_split to walk backward through ancestors and find
the nearest cached non-null split, bridging over gap commits
- Add parent-consistency check to verify_cache: detect orphaned splits
where the split has no parents but the original has reachable ancestors
- Move verify_cache before split and call it on every split, so the
cache self-heals without requiring external callers to verify first
- Remove duplicate verify+clear from monopam push (now handled by split)
- Add opam-repo cleaning to monopam clean

+8 -7
+8
lib/clean.ml
··· 88 88 with Eio.Io _ -> [] 89 89 in 90 90 91 + let opam_repo_cleaned = 92 + let opam_repo = Config.Paths.opam_repo config in 93 + check_and_fix ~fs_t ~dry_run ~name:"opam-repo" 94 + ~check_fn:(fun repo ~head -> Git.Subtree.check_mono repo ~head ()) 95 + ~fix_fn:(fun repo ~head -> Git.Subtree.fix_mono repo ~head ()) 96 + opam_repo 97 + in 91 98 let total_cleaned = 92 99 Option.value ~default:0 mono_cleaned 100 + + Option.value ~default:0 opam_repo_cleaned 93 101 + List.fold_left ( + ) 0 checkout_results 94 102 in 95 103 if total_cleaned = 0 then begin
-7
lib/push.ml
··· 20 20 21 21 let split_and_push ~proc ~fs ~monorepo ~git_repo ~prefix ~checkout_url ~clean 22 22 ~force ~branch = 23 - let _checked, errors = Git.Subtree.verify git_repo ~prefix () in 24 - if errors <> [] then begin 25 - Log.info (fun m -> 26 - m "Clearing invalid cache for %s (%d errors)" prefix 27 - (List.length errors)); 28 - Git.Subtree.Cache.clear git_repo ~prefix 29 - end; 30 23 match Git.Repository.read_ref git_repo "HEAD" with 31 24 | None -> Error (Ctx.Git_error (Git_cli.Io_error "no HEAD ref found")) 32 25 | Some head -> (