Skip to content

Commit

Permalink
Copy files instead of rsync when they are in a local cache
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Jul 10, 2020
1 parent 1b645db commit bcf4fea
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/repository/opamRepository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ let fetch_from_cache =
~quiet:true ~validate:false ~overwrite:true ~checksum
url file
| `rsync ->
(OpamLocal.rsync_file url file @@| function
| Result _ | Up_to_date _-> ()
| Not_available (s,l) -> raise (OpamDownload.Download_fail (s,l)))
begin match OpamUrl.local_file url with
| Some src ->
OpamFilename.copy src file;
OpamProcess.Job.Op.Done ()
| None ->
(OpamLocal.rsync_file url file @@| function
| Result _ | Up_to_date _-> ()
| Not_available (s,l) -> raise (OpamDownload.Download_fail (s,l)))
end
| #OpamUrl.version_control ->
failwith "Version control not allowed as cache URL"
in
Expand Down

0 comments on commit bcf4fea

Please sign in to comment.