aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBasil L. Contovounesios <contovob@tcd.ie>2017-06-27 13:59:51 +0200
committerKyle Meyer <kyle@kyleam.com>2017-06-29 23:23:58 -0400
commitd85547a4e68ecdfd3d39c8a6b319b6568bb91dd6 (patch)
treeb62a8793fed3a92f0075da386dfc58bbb45fc9a4
parent524ee09dc4312c52bd8c23c13b18bee23f15bb53 (diff)
magit-{init,status}: compare toplevels by truename
This allows user input, whether read interactively or from magit-repository-directories, involving symlinked files to be compared to the result of magit-toplevel with find-file-visit-truename enabled.
-rw-r--r--Documentation/RelNotes/2.11.0.txt5
-rw-r--r--lisp/magit-status.el4
2 files changed, 7 insertions, 2 deletions
diff --git a/Documentation/RelNotes/2.11.0.txt b/Documentation/RelNotes/2.11.0.txt
index dd4c2e0..f5cd433 100644
--- a/Documentation/RelNotes/2.11.0.txt
+++ b/Documentation/RelNotes/2.11.0.txt
@@ -117,6 +117,11 @@ Fixes since v2.10.3
not into its own upstream branch, then the user was not offered to
force the deletion, causing it to fail. #3107
+* With `find-file-visit-truename' set to a non-nil value, the commands
+ `magit-status' and `magit-init' failed to detect when their
+ directory argument was a symlink that resolved to the output of
+ `magit-toplevel'. #3115
+
This release also contains the fixes described in the v2.10.{1,2,3}
release notes, as well as other minor improvements, bug fixes, typo
fixes, and documentation fixes.
diff --git a/lisp/magit-status.el b/lisp/magit-status.el
index e8404e2..a2c9c8a 100644
--- a/lisp/magit-status.el
+++ b/lisp/magit-status.el
@@ -151,7 +151,7 @@ Non-interactively DIRECTORY is (re-)initialized unconditionally."
(read-directory-name "Create repository in: ")))))
(-when-let (toplevel (magit-toplevel directory))
(setq toplevel (expand-file-name toplevel))
- (unless (y-or-n-p (if (string-equal toplevel directory)
+ (unless (y-or-n-p (if (file-equal-p toplevel directory)
(format "Reinitialize existing repository %s? "
directory)
(format "%s is a repository. Create another in %s? "
@@ -177,7 +177,7 @@ then offer to initialize it as a new repository."
(if directory
(let ((toplevel (magit-toplevel directory)))
(setq directory (file-name-as-directory (expand-file-name directory)))
- (if (and toplevel (string-equal directory toplevel))
+ (if (and toplevel (file-equal-p directory toplevel))
(magit-status-internal directory)
(when (y-or-n-p
(if toplevel