From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#9597: update Date: Sun, 25 Dec 2016 15:40:54 -0800 Message-ID: <87bmvzefw9.fsf@secretsauce.net> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1482709277 20494 195.159.176.226 (25 Dec 2016 23:41:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 25 Dec 2016 23:41:17 +0000 (UTC) User-Agent: mu4e 0.9.17; emacs 26.0.50.1 To: 9597@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 26 00:41:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLIPd-0004ci-VU for geb-bug-gnu-emacs@m.gmane.org; Mon, 26 Dec 2016 00:41:10 +0100 Original-Received: from localhost ([::1]:48258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLIPi-00076m-I4 for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Dec 2016 18:41:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLIPc-00076T-3K for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2016 18:41:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLIPX-00075b-7D for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2016 18:41:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39660) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cLIPW-00075V-VV for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2016 18:41:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cLIPW-0002h8-JP for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2016 18:41:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Dec 2016 23:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9597 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9597-submit@debbugs.gnu.org id=B9597.148270925810341 (code B ref 9597); Sun, 25 Dec 2016 23:41:02 +0000 Original-Received: (at 9597) by debbugs.gnu.org; 25 Dec 2016 23:40:58 +0000 Original-Received: from localhost ([127.0.0.1]:55059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLIPS-0002gj-1J for submit@debbugs.gnu.org; Sun, 25 Dec 2016 18:40:58 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:45068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLIPQ-0002gb-Dt for 9597@debbugs.gnu.org; Sun, 25 Dec 2016 18:40:56 -0500 Original-Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id AB9E020850 for <9597@debbugs.gnu.org>; Sun, 25 Dec 2016 18:40:55 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 25 Dec 2016 18:40:55 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=content-type:date:from:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=7N4 zLRFc2V1zfyF8XYh88fD62Dk=; b=TD3mNr66VaUyMU5hSCDv69q/woK9ewo33na m38k/EJsBc49STJbfDrfD58OqnhKebTfquVfQx1XRRdxQ2uM59NPgwruLSKissVo QmALNwKv/JG0byz6d3Y/u84sXDcWkGTTGc9PcyVgwnpw4i7MzygB3pKaInFCRZg9 zNl/MUiQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=smtpout; bh=7N4zLRFc2V1zfyF8XYh88fD62Dk=; b=SWq4G P/62/2WSGiMV5hkXkaVlHjruequSV03DnqInJgsajdtWrrBMc3GO03hmOY0nL2Ad PESjYaEGtpGJnTWdk9dATCXZTCSvFK+wspnBuUfqn8gS+hd3BXsk8vNi42ooS+QA w4Lzba/r7r7UD7bR8QLDIOskskhhcVQJfVTh9k= X-ME-Sender: X-Sasl-enc: Y1dAL4MO6r2gnZufNlCDWFoGXg4ysethbZPmD+bG8RIH 1482709255 Original-Received: from shorty.local (50-1-153-216.dsl.dynamic.fusionbroadband.com [50.1.153.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 557CA2452C for <9597@debbugs.gnu.org>; Sun, 25 Dec 2016 18:40:55 -0500 (EST) Original-Received: from dima by shorty.local with local (Exim 4.87) (envelope-from ) id 1cLIPO-0005aj-8h for 9597@debbugs.gnu.org; Sun, 25 Dec 2016 15:40:54 -0800 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:127448 Archived-At: --=-=-= Content-Type: text/plain Hi. This is still an outstanding bug. Can we please revisit this? I'm attaching a version of Juri Linkov's patch that applies cleanly to the latest master. This patch solves the issue. Do we not like it? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=fix-git-diffs.patch diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 75fd420..d1a5156 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -437,6 +437,9 @@ diff-valid-unified-empty-line (defconst diff-hunk-header-re (concat "^\\(?:" diff-hunk-header-re-unified ".*\\|\\*\\{15\\}.*\n\\*\\*\\* .+ \\*\\*\\*\\*\\|[0-9]+\\(,[0-9]+\\)?[acd][0-9]+\\(,[0-9]+\\)?\\)$")) (defconst diff-file-header-re (concat "^\\(--- .+\n\\+\\+\\+ \\|\\*\\*\\* .+\n--- \\|[^-+!<>0-9@* \n]\\).+\n" (substring diff-hunk-header-re 1))) + +(defconst diff-separator-re "^--+ ?$") + (defvar diff-narrowed-to nil) (defun diff-hunk-style (&optional style) @@ -1604,15 +1607,20 @@ diff-sanity-check-hunk (pcase (char-after) (?\s (cl-decf before) (cl-decf after) t) (?- - (if (and (looking-at diff-file-header-re) - (zerop before) (zerop after)) - ;; No need to query: this is a case where two patches - ;; are concatenated and only counting the lines will - ;; give the right result. Let's just add an empty - ;; line so that our code which doesn't count lines - ;; will not get confused. - (progn (save-excursion (insert "\n")) nil) - (cl-decf before) t)) + (cond + ((and (looking-at diff-separator-re) + (zerop before) (zerop after)) + nil) + ((and (looking-at diff-file-header-re) + (zerop before) (zerop after)) + ;; No need to query: this is a case where two patches + ;; are concatenated and only counting the lines will + ;; give the right result. Let's just add an empty + ;; line so that our code which doesn't count lines + ;; will not get confused. + (save-excursion (insert "\n")) nil) + (t + (cl-decf before) t))) (?+ (cl-decf after) t) (_ (cond --=-=-=--