Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Dec 2017 16:25:33 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327064 - head/usr.bin/patch
Message-ID:  <201712211625.vBLGPXpY022369@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Dec 21 16:25:33 2017
New Revision: 327064
URL: https://svnweb.freebsd.org/changeset/base/327064

Log:
  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)

Modified:
  head/usr.bin/patch/pch.c

Modified: head/usr.bin/patch/pch.c
==============================================================================
--- head/usr.bin/patch/pch.c	Thu Dec 21 16:19:10 2017	(r327063)
+++ head/usr.bin/patch/pch.c	Thu Dec 21 16:25:33 2017	(r327064)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201712211625.vBLGPXpY022369>