summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <tb>2017-12-20 21:08:06 +0000
committertb <tb>2017-12-20 21:08:06 +0000
commit988b05dfa691c1af72aca16b98fe1a330cfb4cad (patch)
tree5a1977cee67b6e58d85dcd15beac1107b6458cd7
parenta88039ee43a8c6637fc62c8bc0f612134d897056 (diff)
downloadpatch-988b05dfa691c1af72aca16b98fe1a330cfb4cad.tar
patch-988b05dfa691c1af72aca16b98fe1a330cfb4cad.tar.gz
Fix adding and removing files with git-style a/ b/ diffs: only skipHEADOPENBSD_6_3_BASEmaster
six letters if they actually match "--- a/" and "+++ b/" instead of laxer checks. ok tom, tedu, millert
-rw-r--r--pch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/pch.c b/pch.c
index 2e3974c..d0f6ccf 100644
--- a/pch.c
+++ b/pch.c
@@ -301,14 +301,16 @@ intuit_diff_type(void)
&names[OLD_FILE].exists, strippath);
else if (strnEQ(s, "--- ", 4)) {
size_t off = 4;
- if (piece_of_git && strippath == 957)
+ if (piece_of_git && strippath == 957 &&
+ strnEQ(s, "--- a/", 6))
off = 6;
names[NEW_FILE].path = fetchname(s + off,
&names[NEW_FILE].exists, strippath);
} else if (strnEQ(s, "+++ ", 4)) {
/* pretend it is the old name */
size_t off = 4;
- if (piece_of_git && strippath == 957)
+ if (piece_of_git && strippath == 957 &&
+ strnEQ(s, "+++ b/", 6))
off = 6;
names[OLD_FILE].path = fetchname(s + off,
&names[OLD_FILE].exists, strippath);