From owner-svn-src-head@freebsd.org Thu Dec 21 16:25:34 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57EF7EA162E; Thu, 21 Dec 2017 16:25:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2077E6CA78; Thu, 21 Dec 2017 16:25:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBLGPX4x022370; Thu, 21 Dec 2017 16:25:33 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBLGPXpY022369; Thu, 21 Dec 2017 16:25:33 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201712211625.vBLGPXpY022369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 21 Dec 2017 16:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327064 - head/usr.bin/patch X-SVN-Group: head X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: head/usr.bin/patch X-SVN-Commit-Revision: 327064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Dec 2017 16:25:34 -0000 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);