patchutils
patchutils copied to clipboard
recountdiff sometimes corrupts headers on new files
test case from this repo itself
$ git format-patch -1 9b2c63001e046f46defa31a3552c144804421f20
0001-Patchview-addon-are-3-bash-and-1-python-scripts.patch
$ perl ./scripts/recountdiff 0001-Patchview-addon-are-3-bash-and-1-python-scripts.patch > new
$ diff -u 0001-Patchview-addon-are-3-bash-and-1-python-scripts.patch new
--- 0001-Patchview-addon-are-3-bash-and-1-python-scripts.patch 2021-03-08 19:45:06.264198350 -0500
+++ new 2021-03-08 19:46:13.017530685 -0500
@@ -202,7 +202,7 @@
index 000000000000..d9e474d259e2
--- /dev/null
+++ b/patchview/svndiffview
-@@ -0,0 +1,20 @@
+@@ -1 +1,20 @@
+#!/bin/sh
+#
+# Copyright (C) 2014-2019 Sérgio Basto <[email protected]>
$ git checkout 9b2c63001e046f46defa31a3552c144804421f20^
HEAD is now at 59182fb144a2 doc/patchutils.xml with patchview
$ patch -p1 --dry-run < 0001-Patchview-addon-are-3-bash-and-1-python-scripts.patch
checking file Makefile.am
checking file patchview/README.patchview
checking file patchview/gitdiff
checking file patchview/gitdiffview
checking file patchview/svndiff
checking file patchview/svndiffview
$ patch -p1 --dry-run < new
checking file Makefile.am
checking file patchview/README.patchview
checking file patchview/gitdiff
checking file patchview/gitdiffview
checking file patchview/svndiff
checking file patchview/svndiffview
Hunk #1 FAILED at 1.
1 out of 1 hunk FAILED
I can confirm this is still an issue. The patch file I am editing that adds a new file, when run against recountdiff, changes "-0,0" to "-1" and the patch can no longer apply