Installs pre-commit hooks for OCaml projects that run dune fmt automatically
1
fork

Configure Feed

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

precommit: fix Eio switch scope — repo must live inside switch

+8 -16
+8 -16
lib/precommit.ml
··· 408 408 [] 409 409 | Some git_root -> ( 410 410 Log.debug (fun m -> m "check_ai_attribution: git_root=%s" git_root); 411 - let repo = 412 - Eio.Switch.run @@ fun sw -> 413 - Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) 414 - in 411 + Eio.Switch.run @@ fun sw -> 412 + let repo = Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) in 415 413 let user_email = user_email ~fs:ctx.fs repo in 416 414 Log.debug (fun m -> 417 415 m "check_ai_attribution: git_root=%s user_email=%s" git_root ··· 442 440 match git_root ~cwd:ctx.cwd ~fs:ctx.fs dir with 443 441 | None -> None 444 442 | Some git_root -> 445 - let repo = 446 - Eio.Switch.run @@ fun sw -> 447 - Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) 448 - in 443 + Eio.Switch.run @@ fun sw -> 444 + let repo = Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) in 449 445 Git.Repository.current_branch repo 450 446 451 447 let backup_branch ctx dir = 452 448 match git_root ~cwd:ctx.cwd ~fs:ctx.fs dir with 453 449 | None -> Fmt.failwith "%s: No .git directory found" dir 454 450 | Some git_root -> 455 - let repo = 456 - Eio.Switch.run @@ fun sw -> 457 - Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) 458 - in 451 + Eio.Switch.run @@ fun sw -> 452 + let repo = Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) in 459 453 let branch = 460 454 match Git.Repository.current_branch repo with 461 455 | Some b -> b ··· 530 524 match git_root ~cwd:ctx.cwd ~fs:ctx.fs dir with 531 525 | None -> err_no_git_dir dir 532 526 | Some git_root -> ( 533 - let repo = 534 - Eio.Switch.run @@ fun sw -> 535 - Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) 536 - in 527 + Eio.Switch.run @@ fun sw -> 528 + let repo = Git.Repository.open_repo ~sw ~fs:ctx.fs (Fpath.v git_root) in 537 529 let user_email = user_email ~fs:ctx.fs repo in 538 530 match Git.Repository.head repo with 539 531 | None -> Ok 0