branch: elpa/sesman commit 3df33018f1c42f09db21cebe39a25b389fe35f02 Author: Vitalie Spinu <spinu...@gmail.com> Commit: Vitalie Spinu <spinu...@gmail.com>
Strip trailing slash in `sesman-expand-path` clojure-emacs/cider#2577 --- sesman-test.el | 6 ++++-- sesman.el | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sesman-test.el b/sesman-test.el index 0a0c63c74f..48420cba2b 100644 --- a/sesman-test.el +++ b/sesman-test.el @@ -254,9 +254,11 @@ (ert-deftest sesman-symlinked-projects-tests () (let* ((dir1 (make-temp-file "1-" 'dir)) (dir2 (make-temp-file "2-" 'dir)) - (dir1-link (format "%s/dir1" dir2 dir1))) + (dir1-link (format "%s/dir1" dir2))) + ;; dir1 link in dir2 - (shell-command (format "ln -s %s %s" dir1 dir1-link)) + (should (equal (shell-command (format "ln -s %s %s" dir1 dir1-link)) + 0)) (let ((sesman-follow-symlinks nil) (vc-follow-symlinks t)) diff --git a/sesman.el b/sesman.el index 875f2dda73..1ffeed97ee 100644 --- a/sesman.el +++ b/sesman.el @@ -926,16 +926,17 @@ buffers." (defun sesman-expand-path (path) "Expand PATH with optionally follow symlinks. Whether symlinks are followed is controlled by `sesman-follow-symlinks' custom -variable." - (if sesman-follow-symlinks - (let ((true-name (or (gethash path sesman--path-cache) - (puthash path (file-truename path) sesman--path-cache)))) - (if (or (eq sesman-follow-symlinks t) - vc-follow-symlinks) - true-name - ;; sesman-follow-symlinks is 'vc but vc-follow-symlinks is nil - (expand-file-name path))) - (expand-file-name path))) +variable. Always return the expansion without the trailing directory slash." + (directory-file-name + (if sesman-follow-symlinks + (let ((true-name (or (gethash path sesman--path-cache) + (puthash path (file-truename path) sesman--path-cache)))) + (if (or (eq sesman-follow-symlinks t) + vc-follow-symlinks) + true-name + ;; sesman-follow-symlinks is 'vc but vc-follow-symlinks is nil + (expand-file-name path))) + (expand-file-name path)))) ;;; Contexts