Skip to content

Commit 8cb4d08

Browse files
committed
Add support for git format-patch headers
1 parent 481cb87 commit 8cb4d08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/patch.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,12 @@ let to_diff data =
238238
(* first locate --- and +++ lines *)
239239
let rec find_start git ?hdr = function
240240
| [] -> hdr, []
241-
| x::xs when String.is_prefix ~prefix:"diff --git" x ->
241+
| x::xs when String.is_prefix ~prefix:"diff --git " x ->
242242
begin match hdr with None -> find_start true xs | Some _ -> hdr, x::xs end
243-
| x::y::xs when String.is_prefix ~prefix:"rename from" x && String.is_prefix ~prefix:"rename to" y ->
243+
| x::y::xs when String.is_prefix ~prefix:"rename from " x && String.is_prefix ~prefix:"rename to " y ->
244244
let hdr = Rename_only (String.slice ~start:12 x, String.slice ~start:10 y) in
245245
find_start git ~hdr xs
246-
| x::y::xs when String.is_prefix ~prefix:"---" x ->
246+
| x::y::xs when String.is_prefix ~prefix:"--- " x ->
247247
let mine = String.slice ~start:4 x and their = String.slice ~start:4 y in
248248
Some (operation_of_strings git mine their), xs
249249
| _::xs -> find_start git ?hdr xs

0 commit comments

Comments
 (0)