diff icon indicating copy to clipboard operation
diff copied to clipboard

Broken parsing for patches with `new file mode 100644`

Open janedbal opened this issue 2 months ago • 0 comments

When a file contains new files, diff chunks contain a line with patch contents (new file mode 100644), not the actual file contents.

Example patch:

diff --git a/file1.txt b/file1.txt
new file mode 100644
--- /dev/null
+++ b/file1.txt
@@ -0,0 +1,2 @@
+Line A
+Line B
diff --git a/file2.txt b/file2.txt
new file mode 100644
--- /dev/null
+++ b/file2.txt
@@ -0,0 +1,2 @@
+Line X
+Line Y

Reproduced in https://github.com/sebastianbergmann/diff/pull/132

janedbal avatar Oct 10 '25 15:10 janedbal