Skip to content

Commit 1bb87b6

Browse files
committed
improve apply-multiple-patches
1 parent 2b86e1f commit 1bb87b6

6 files changed

+24
-6
lines changed

integration-tests/apply-multiple-patches/__snapshots__/apply-multiple-patches.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ patch-package 0.0.0
66
Applying patches...
77
left-pad@1.3.0 (1 hello) ✔
88
left-pad@1.3.0 (3 world) ✔
9+
left-pad@1.3.0 (4 goodbye) ✔
910
END SNAPSHOT"
1011
`;
1112

@@ -26,7 +27,7 @@ exports[`Test apply-multiple-patches: 02: patch-package fails when a patch in th
2627
2728
This error was caused because patch-package cannot apply the following patch file:
2829
29-
patches/left-pad+1.3.0+02+broken.patch
30+
patches/left-pad+1.3.0+002+broken.patch
3031
3132
Try removing node_modules and trying again. If that doesn't work, maybe there was
3233
an accidental change made to the patch file? Try recreating it by manually

integration-tests/apply-multiple-patches/apply-multiple-patches.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ echo "SNAPSHOT: patch-package happily applies both good patches"
1212
patch-package
1313
echo "END SNAPSHOT"
1414

15+
echo "it should work if we apply them again even though they touch the same parts of the code"
16+
if ! patch-package
17+
then
18+
exit 1
19+
fi
20+
1521
cp *broken.patch patches/
1622

1723
(>&2 echo "SNAPSHOT: patch-package fails when a patch in the sequence is invalid")
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js
2-
index e90aec3..409dad7 100644
2+
index e90aec3..fd5a1d0 100644
33
--- a/node_modules/left-pad/index.js
44
+++ b/node_modules/left-pad/index.js
55
@@ -1,3 +1,4 @@
6-
+// hello. this is the first patch
6+
+// hello
77
/* This program is free software. It comes without any warranty, to
88
* the extent permitted by applicable law. You can redistribute it
99
* and/or modify it under the terms of the Do What The Fuck You Want
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js
2+
index fd5a1d0..65f8689 100644
3+
--- a/node_modules/left-pad/index.js
4+
+++ b/node_modules/left-pad/index.js
5+
@@ -1,3 +1,4 @@
6+
+// world
7+
// hello
8+
/* This program is free software. It comes without any warranty, to
9+
* the extent permitted by applicable law. You can redistribute it
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
diff --git a/node_modules/left-pad/index.js b/node_modules/left-pad/index.js
2-
index e90aec3..409dad7 100644
2+
index 65f8689..2f2abc3 100644
33
--- a/node_modules/left-pad/index.js
44
+++ b/node_modules/left-pad/index.js
5-
@@ -1,3 +1,4 @@
6-
+// hello. this is the first patch
5+
@@ -1,5 +1,5 @@
6+
// world
7+
-// hello
8+
+// goodbye
79
/* This program is free software. It comes without any warranty, to
810
* the extent permitted by applicable law. You can redistribute it
911
* and/or modify it under the terms of the Do What The Fuck You Want

0 commit comments

Comments
 (0)