summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2024-01-25 00:57:00 +0100
committerMaxime Coste <mawww@kakoune.org>2024-01-26 09:55:52 +1100
commit11e7e2964c9aa80db28fb2bc335e0d43044ea233 (patch)
tree36644482f2b0ff30546a9de40ad71129a9f4f4ba /test
parentc7eeb0ead5d35b3dac6feb7ce51ef33304ba792d (diff)
rc tools patch: skip patch message signature, fixing diff application
Patches as produced by "git format-patch" have a trailing signature that is separated from the body by a line with "-- " on it. By default it contains the Git version. We erroneously include this signature in the diff we pipe to patch, which fails to apply as a result. Add a targeted fix to suppress these signatures.
Diffstat (limited to 'test')
-rw-r--r--test/tools/patch/signature/cmd1
-rw-r--r--test/tools/patch/signature/in10
-rw-r--r--test/tools/patch/signature/out20
-rw-r--r--test/tools/patch/signature/rc1
4 files changed, 32 insertions, 0 deletions
diff --git a/test/tools/patch/signature/cmd b/test/tools/patch/signature/cmd
new file mode 100644
index 00000000..2b5ac0b6
--- /dev/null
+++ b/test/tools/patch/signature/cmd
@@ -0,0 +1 @@
+%:patch tee applied.diff<ret><ret>!echo Applied:; cat applied.diff; echo; echo Updated buffer:<ret>
diff --git a/test/tools/patch/signature/in b/test/tools/patch/signature/in
new file mode 100644
index 00000000..acceecf7
--- /dev/null
+++ b/test/tools/patch/signature/in
@@ -0,0 +1,10 @@
+diff -ur a/file1 b/file1
+--- a/file1
++++ b/file1
+@@ -1,3 +1,3 @@
+ context
+-file1 here
++modified file1 here
+ context
+--
+2.43.0
diff --git a/test/tools/patch/signature/out b/test/tools/patch/signature/out
new file mode 100644
index 00000000..3c4120f3
--- /dev/null
+++ b/test/tools/patch/signature/out
@@ -0,0 +1,20 @@
+Applied:
+diff -ur a/file1 b/file1
+--- a/file1
++++ b/file1
+@@ -1,3 +1,3 @@
+ context
+-file1 here
++modified file1 here
+ context
+
+Updated buffer:
+diff -ur a/file1 b/file1
+--- a/file1
++++ b/file1
+@@ -1,3 +1,3 @@
+ context
+ modified file1 here
+ context
+--
+2.43.0
diff --git a/test/tools/patch/signature/rc b/test/tools/patch/signature/rc
new file mode 100644
index 00000000..62ee8585
--- /dev/null
+++ b/test/tools/patch/signature/rc
@@ -0,0 +1 @@
+source "%val{runtime}/rc/tools/patch.kak"