diff --git a/magit.el b/magit.el index 1069937c..55abf37f 100644 --- a/magit.el +++ b/magit.el @@ -302,6 +302,9 @@ Many Magit faces inherit from this one by default." (defvar magit-completing-read 'completing-read "Function to be called when requesting input from the user.") +(defvar magit-read-rev-history nil + "The history of inputs to `magit-read-rev'.") + (defvar magit-omit-untracked-dir-contents nil "When non-nil magit will only list an untracked directory, not its contents.") @@ -468,7 +471,7 @@ Many Magit faces inherit from this one by default." dirs)))) (defun magit-get-top-dir (cwd) - (let ((cwd (expand-file-name cwd))) + (let ((cwd (expand-file-name (file-truename cwd)))) (when (file-directory-p cwd) (let* ((default-directory cwd) (cdup (magit-git-string "rev-parse" "--show-cdup"))) @@ -587,7 +590,7 @@ return nil." (format "%s: " prompt))) (interesting-refs (magit-list-interesting-refs)) (reply (funcall magit-completing-read prompt interesting-refs - nil nil nil nil def)) + nil nil nil 'magit-read-rev-history def)) (rev (or (cdr (assoc reply interesting-refs)) reply))) (if (string= rev "") nil @@ -4022,7 +4025,12 @@ Return values: (defun magit--branch-name-from-line (line) "Extract the branch name from line LINE of 'git branch' output." - (get-text-property 0 'branch-name line)) + (let ((branch (get-text-property 0 'branch-name line))) + (if (and branch + (get-text-property 0 'remote line) + (string-match-p "^remotes/" branch)) + (substring branch 8) + branch))) (defun magit--branch-name-at-point () "Get the branch name in the line at point." @@ -4081,7 +4089,8 @@ With prefix force the removal even it it hasn't been merged." ) branch-line) (let ((res (list (cons 'current (match-string 1 branch-line)) - (cons 'branch (match-string 2 branch-line))))) + (cons 'branch (match-string 2 branch-line)) + (cons 'remote (string-match-p "^remotes/" (match-string 2 branch-line)))))) (if (match-string 4 branch-line) (cons (cons 'other-ref (match-string 6 branch-line)) res) (append