Commit ae1bc41f authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-visit-ref: drop prefix before calling magit-show-commit

Unless `focus-on-ref' is a member of `magit-visit-ref-behavior', the
prefix argument was simply passed along to `magit-show-commit', which
was inconvenient because that then prompted for the commit to show
instead of just showing the commit at point (tag or tip of branch).

Now we drop the prefix argument before calling `magit-show-commit',
but only if that command would not have been called without a prefix
argument anyway.

Closes #3009.
parent 8f0de31d
......@@ -105,6 +105,9 @@ Changes since v2.11.0
are additional characters before the "leading" tabs that should
count as an additional, but very short tab-stop. #3185
* The command `magit-visit-ref' now drops the prefix argument before
calling `magit-show-commit' when appropriate. #3009
Fixes since v2.11.0
......@@ -335,9 +335,13 @@ different, but only if you have customized the option
(if (and (derived-mode-p 'magit-refs-mode)
(magit-section-match '(branch tag)))
(let ((ref (magit-section-value (magit-current-section))))
(cond ((and (memq 'focus-on-ref magit-visit-ref-behavior)
(magit-show-refs ref))
(cond (current-prefix-arg
(cond ((memq 'focus-on-ref magit-visit-ref-behavior)
(magit-show-refs ref))
;; Don't prompt for commit to visit.
(let ((current-prefix-arg nil))
(call-interactively #'magit-show-commit)))))
((and (memq 'create-branch magit-visit-ref-behavior)
(magit-section-match [branch remote]))
(let ((branch (cdr (magit-split-branch-name ref))))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment