diff options
| author | Johannes Altmanninger <aclopte@gmail.com> | 2024-01-22 06:58:20 +0100 |
|---|---|---|
| committer | Johannes Altmanninger <aclopte@gmail.com> | 2024-01-22 07:02:31 +0100 |
| commit | 1276e67ef720b19bfe5354495ae72e08c00226ee (patch) | |
| tree | 9723130824d28a318c58712ad45ec6181822ef3d /test/tools | |
| parent | 869e89b3e5f05acb213d04ea496a0c22c86d90bc (diff) | |
rc tools patch: skip spurious diff header for files with no changes
Since :patch transforms its inputs into context-only lines, we can
easily get into a state where a file diff has only context lines.
git apply does not accept a "diff" without any hunk, so let's skip
that.
Diffstat (limited to 'test/tools')
| -rw-r--r-- | test/tools/patch/ignore-first-file/cmd | 1 | ||||
| -rw-r--r-- | test/tools/patch/ignore-first-file/in | 11 | ||||
| -rw-r--r-- | test/tools/patch/ignore-first-file/out | 19 | ||||
| -rw-r--r-- | test/tools/patch/ignore-first-file/rc | 1 |
4 files changed, 32 insertions, 0 deletions
diff --git a/test/tools/patch/ignore-first-file/cmd b/test/tools/patch/ignore-first-file/cmd new file mode 100644 index 00000000..2b5ac0b6 --- /dev/null +++ b/test/tools/patch/ignore-first-file/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/ignore-first-file/in b/test/tools/patch/ignore-first-file/in new file mode 100644 index 00000000..5738a9b9 --- /dev/null +++ b/test/tools/patch/ignore-first-file/in @@ -0,0 +1,11 @@ +diff -ur a/file1 b/file1 +--- a/file1 ++++ b/file1 +@@ -1 +1 @@ + file1 here +diff -ur a/file2 b/file2 +--- a/file2 ++++ b/file2 +@@ -1 +1 @@ +-file2 here ++modified file2 here diff --git a/test/tools/patch/ignore-first-file/out b/test/tools/patch/ignore-first-file/out new file mode 100644 index 00000000..11d3d3af --- /dev/null +++ b/test/tools/patch/ignore-first-file/out @@ -0,0 +1,19 @@ +Applied: +diff -ur a/file2 b/file2 +--- a/file2 ++++ b/file2 +@@ -1 +1 @@ +-file2 here ++modified file2 here + +Updated buffer: +diff -ur a/file1 b/file1 +--- a/file1 ++++ b/file1 +@@ -1 +1 @@ + file1 here +diff -ur a/file2 b/file2 +--- a/file2 ++++ b/file2 +@@ -1 +1 @@ + modified file2 here diff --git a/test/tools/patch/ignore-first-file/rc b/test/tools/patch/ignore-first-file/rc new file mode 100644 index 00000000..62ee8585 --- /dev/null +++ b/test/tools/patch/ignore-first-file/rc @@ -0,0 +1 @@ +source "%val{runtime}/rc/tools/patch.kak" |
