1 ;; Copyright (C) 2017 Free Software Foundation, Inc
3 ;; Author: Dima Kogan <dima@secretsauce.net>
4 ;; Maintainer: emacs-devel@gnu.org
6 ;; This file is part of GNU Emacs.
8 ;; GNU Emacs is free software: you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; GNU Emacs is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 (ert-deftest diff-mode-test-ignore-trailing-dashes
()
27 "Check to make sure we successfully ignore trailing -- made by
28 'git format-patch'. This is bug #9597"
30 ;; I made a test repo, put some files in it, made arbitrary changes
31 ;; and invoked 'git format-patch' to get a patch out of it. The
32 ;; patch and the before and after versions of the files appear here.
33 ;; The test simply tries to apply the patch. The patch contains
34 ;; trailing --, which confused diff-mode previously
35 (let ((patch "From 18ed35640be496647e0a02fc155b4ee4a0490eca Mon Sep 17 00:00:00 2001
36 From: Dima Kogan <dima@secretsauce.net>
37 Date: Mon, 30 Jan 2017 22:24:13 -0800
38 Subject: [PATCH] test commit
43 2 files changed, 7 deletions(-)
45 diff --git a/fil b/fil
46 index 10344f1..2a56245 100644
49 @@ -2,10 +2,8 @@ Afrocentrism
60 @@ -15,6 +13,5 @@ Aristophanes
67 diff --git a/fil2 b/fil2
68 index 8858f0d..86e8ea5 100644
96 (fil_before "Afrocentrism
117 (fil_after "Afrocentrism
135 (fil2_before "whippoorwills
156 (fil2_after "whippoorwills
173 (temp-dir (make-temp-file "diff-mode-test" 'dir
)))
175 (let ((buf (find-file-noselect (format "%s/%s" temp-dir
"fil" )))
176 (buf2 (find-file-noselect (format "%s/%s" temp-dir
"fil2"))))
179 (with-current-buffer buf
(insert fil_before
) (save-buffer))
180 (with-current-buffer buf2
(insert fil2_before
) (save-buffer))
185 (beginning-of-buffer)
190 (should (equal (with-current-buffer buf
(buffer-string))
192 (should (equal (with-current-buffer buf2
(buffer-string))
196 (with-current-buffer buf
(set-buffer-modified-p nil
))
198 (with-current-buffer buf2
(set-buffer-modified-p nil
))
200 (delete-directory temp-dir
'recursive
))))))
203 (provide 'diff-mode-tests
)