Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pkg): Check that git repo dir is accessible #9019

Merged
merged 4 commits into from
Oct 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/dune_pkg/rev_store.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ let show { dir } (Rev rev) path =

let load_or_create ~dir =
let t = { dir } in
(* TODO might as well double check it's a directory *)
match Path.exists dir with
| true -> Fiber.return t
| false ->
Path.mkdir_p dir;
let+ () = run t [ "init"; "--bare" ] in
t
let* () = Fiber.return () in
let+ () =
match Fpath.mkdir_p (Path.to_string dir) with
| Already_exists -> Fiber.return ()
rgrinberg marked this conversation as resolved.
Show resolved Hide resolved
| Created -> run t [ "init"; "--bare" ]
| exception Unix.Unix_error (e, x, y) ->
User_error.raise
[ Pp.textf "%s isn't a directory" (Path.to_string_maybe_quoted dir)
; Pp.textf "reason: %s" (Unix_error.Detailed.to_string_hum (e, x, y))
]
~hints:[ Pp.text "delete this file or check its permissions" ]
in
t
;;

module Remote = struct
Expand Down
Loading