From b63b99d99cf597918fb82b9111143e03af6ba606 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Tue, 22 Nov 2016 15:23:28 -0800 Subject: [PATCH] (autodetect-patch-directory-root) doesn't get confused by symlinks Prior to this patch you could have a scenario where - The filename in the first hunk refers to a real file - The emacs buffer returned by (buffer-file-name) is a symlink to this file Since (autodetect-patch-directory-root) comparse paths, this would make the comparison fail in the wrong place, and (autodetect-patch-directory-root) would return a wrong result --- commit-patch-buffer.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-patch-buffer.el b/commit-patch-buffer.el index a247300..7a5ffab 100644 --- a/commit-patch-buffer.el +++ b/commit-patch-buffer.el @@ -152,7 +152,7 @@ following algorithm: (beginning-of-buffer) (diff-hunk-next) ;; Have to be in a hunk or diff-hunk-file-names won't work. (let ((diff-path (reverse (split-string (car (diff-hunk-file-names)) "/"))) - (file-path (reverse (split-string (buffer-file-name (car (diff-find-source-location))) "/")))) + (file-path (reverse (split-string (file-chase-links (buffer-file-name (car (diff-find-source-location)))) "/")))) (while (string-equal (car file-path) (car diff-path)) (setq file-path (cdr file-path)) (setq diff-path (cdr diff-path))) -- 2.51.2