Skip to content

Commit

Permalink
Repro: patch doesn't like timestamps (#10859)
Browse files Browse the repository at this point in the history
* Repro: patch doesn't like timestamps

Signed-off-by: Ambre Austen Suhamy <ambre@tarides.com>
  • Loading branch information
ElectreAAS authored Sep 3, 2024
1 parent dec99d8 commit e63a517
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/expect-tests/dune_patch/dune_patch_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ index ea988f6bd..000000000
|}
;;

(* Use GNU diff 'unified' format instead of 'git diff' *)
let unified =
{|
diff -u a/foo.ml b/foo.ml
--- a/foo.ml 2024-08-29 17:37:53.114980665 +0200
+++ b/foo.ml 2024-08-29 17:38:00.243088256 +0200
@@ -1 +1 @@
-This is wrong
+This is right
|}
;;

(* Testing the patch action *)

include struct
Expand Down Expand Up @@ -147,3 +159,15 @@ let%expect_test "patching a deleted file" =
[%expect {|
File foo.ml not found |}]
;;

let%expect_test "Using a patch from 'diff' with a timestamp" =
try
test [ "foo.ml", "This is wrong\n" ] ("foo.patch", unified);
check "foo.ml";
[%expect.unreachable]
with
| Dune_util.Report_error.Already_reported ->
if String.ends_with ~suffix:"No such file or directory\n" [%expect.output]
then [%expect ""]
else [%expect.unreachable]
;;

0 comments on commit e63a517

Please sign in to comment.