@@ -13,13 +13,13 @@ let dir_is_nonempty path =
1313 (* treat any entry (including hidden) as non-empty; this is a safety check *)
1414 List. length items > 0
1515
16- let run_clone ~repo_url ~git_path ~ force =
16+ let run_clone ~repo_url ~git_path =
1717 let * () = Lwt_io. printl " Miiify Clone" in
1818 let * () = Lwt_io. printlf " Remote: %s" repo_url in
1919 let * () = Lwt_io. printlf " Local: %s" git_path in
2020 let * () = Lwt_io. printl " " in
2121
22- (* Safer default: refuse to clone into an existing non-empty directory unless forced . *)
22+ (* Refuse to clone into an existing non-empty directory. *)
2323 let * () =
2424 if Sys. file_exists git_path then (
2525 if not (Sys. is_directory git_path) then (
@@ -29,21 +29,18 @@ let run_clone ~repo_url ~git_path ~force =
2929 git_path
3030 in
3131 Lwt. fail (Failure " Invalid --git path" )
32- ) else if dir_is_nonempty git_path && not force then (
32+ ) else if dir_is_nonempty git_path then (
3333 let * () =
3434 Lwt_io. eprintlf
3535 " Error: --git directory already exists and is not empty: %s"
3636 git_path
3737 in
3838 let * () =
3939 Lwt_io. eprintl
40- " Refusing to clone into an existing store. Use --force to reuse it. "
40+ " Remove it first if you want to start fresh: rm -rf <git-path> "
4141 in
4242 Lwt. fail (Failure " Refusing to clone into non-empty directory" )
43- ) else if dir_is_nonempty git_path && force then
44- Lwt_io. eprintl
45- " Warning: --force set; reusing existing --git directory (HEAD may change)"
46- else
43+ ) else
4744 Lwt. return_unit
4845 ) else
4946 Lwt. return_unit
@@ -126,12 +123,12 @@ let run_clone ~repo_url ~git_path ~force =
126123 Lwt. fail (Failure " Clone failed" )
127124 ))
128125
129- let clone_repo repo_url git_path force =
126+ let clone_repo repo_url git_path =
130127 let result =
131128 Lwt_main. run
132129 (Lwt. catch
133130 (fun () ->
134- let * () = run_clone ~repo_url ~git_path ~force in
131+ let * () = run_clone ~repo_url ~git_path in
135132 Lwt. return (Ok () ))
136133 (fun exn -> Lwt. return (Error exn )))
137134 in
@@ -152,23 +149,19 @@ let git_path =
152149 let doc = " Local Irmin Git store directory" in
153150 Arg. (value & opt string " git_store" & info [" git" ; " g" ] ~docv: " DIR" ~doc )
154151
155- let force_flag =
156- let doc = " Allow cloning into an existing non-empty --git directory (reuse store; may move HEAD)" in
157- Arg. (value & flag & info [" force" ; " f" ] ~doc )
158-
159152let cmd =
160153 let doc = " Clone remote Git repository into Irmin Git store" in
161154 let man = [
162155 `S Manpage. s_description;
163156 `P " Clones a remote Git repository into a local Irmin Git store." ;
164157 `P " Fetches from remote using Irmin's native sync mechanism." ;
165- `P " By default, refuses to clone into an existing non-empty --git directory." ;
158+ `P " Refuses to clone into an existing non-empty --git directory. Remove it first if needed ." ;
166159 `P " Example:" ;
167160 `Pre " miiify-clone https://github.com/org/annotations.git" ;
168161 `Pre " miiify-clone https://github.com/org/annotations.git --git ./my-db" ;
169162 ] in
170163 let info = Cmd. info " clone" ~version: " 0.1.0" ~doc ~man in
171- Cmd. v info Term. (const clone_repo $ repo_url $ git_path $ force_flag )
164+ Cmd. v info Term. (const clone_repo $ repo_url $ git_path)
172165
173166let () =
174167 (* Initialize RNG for git-paf/mirage-crypto *)
0 commit comments