Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions src/core/opamFilename.ml
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,10 @@ let link ?(relative=false) ~target ~link =
OpamSystem.link target (to_string link)
[@@ocaml.warning "-16"]

let parse_patch ~dir patch_file =
OpamPatch.parse_patch ~translate:(Some (Dir.to_string dir)) (to_string patch_file)
let parse_patch ~translate patch_file =
OpamPatch.parse_patch
~translate:(Option.map Dir.to_string translate)
(to_string patch_file)

module PatchFS = struct
type root = string
Expand Down
9 changes: 6 additions & 3 deletions src/core/opamFilename.mli
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,13 @@ val patch: allow_unclean:bool ->
[`Patch_file of t | `Patch_diffs of Patch.t list ] -> Dir.t ->
(Patch.operation list, exn) result

(** [parse_patch ~dir patch_file] processes and parses a patch file.
(** [parse_patch ~translate patch_file] parses a patch file.
Returns the parsed patch diffs or raises an exception if the patch file
doesn't exist or can't be parsed. *)
val parse_patch : dir:Dir.t -> t -> Patch.t list
doesn't exist or can't be parsed.

@param translate is the target base directory used for the optional
CRLF processing (see {!OpamPatch.translate_patch}). *)
val parse_patch : translate:Dir.t option -> t -> Patch.t list

(** Create an empty file *)
val touch: t -> unit
Expand Down
2 changes: 1 addition & 1 deletion src/repository/opamVCS.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module Make (VCS: VCS) = struct
| Some patch_file ->
try
let diffs =
OpamFilename.parse_patch ~dir:repo_root_dir patch_file
OpamFilename.parse_patch ~translate:(Some repo_root_dir) patch_file
in
OpamRepositoryBackend.Update_patch (patch_file, diffs)
with exn -> Update_err exn
Expand Down
Loading