aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2017-12-21 16:25:33 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2017-12-21 16:25:33 +0000
commit76df519fe099c90ba2188cd1ca6846181b24b4b2 (patch)
tree9f39251b75082e6a0ab363878a48a286e6b55176 /usr.bin/patch
parentc844f14e37e57b9f259fb60423456b297b3951e1 (diff)
downloadsrc-76df519fe099c90ba2188cd1ca6846181b24b4b2.tar.gz
src-76df519fe099c90ba2188cd1ca6846181b24b4b2.zip
patch: further cleanup to git-style diffs.
Fix adding and removing files with git-style a/ b/ diffs: only skip six letters if they actually match "--- a/" and "+++ b/" instead of laxer checks. Obtained from: OpenBSD (CVS 1.59)
Notes
Notes: svn path=/head/; revision=327064
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/pch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index d9087bb32391..0b583ea7eb31 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -311,14 +311,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);