summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2018-04-28 21:48:33 -0400
committerKyle Meyer <kyle@kyleam.com>2018-04-28 21:48:33 -0400
commit6ddc4972208f923e9439c36e512286a89530df38 (patch)
tree9a604f3b1dc07e1c8eb0a3164abcc431dacf1d49 /lisp
parentc428b355e5d0782291dfed96d264065e93855ad6 (diff)
downloademacs.d-6ddc4972208f923e9439c36e512286a89530df38.tar.gz
km/magit-log-dwim: Handle merges in revision buffers
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-magit.el36
1 files changed, 20 insertions, 16 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index b311962..d515acb 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -636,22 +636,26 @@ argument. Interactively, this can be accessed using the command
(defun km/magit-log-dwim (&optional args files)
(interactive (magit-log-arguments))
(let ((range
- (magit-section-case
- ((unpushed unpulled)
- (magit-section-value it))
- (tag
- (concat (magit-section-value it) ".."))
- (branch
- (let ((current (magit-get-current-branch))
- (atpoint (magit-section-value it))
- (upstream (magit-get-upstream-branch))
- (push (magit-get-push-branch)))
- (cond ((equal atpoint current)
- (and upstream (concat upstream "..")))
- ((equal atpoint push)
- (concat push ".."))
- (t
- (concat ".." atpoint))))))))
+ (or (magit-section-case
+ ((unpushed unpulled)
+ (magit-section-value it))
+ (tag
+ (concat (magit-section-value it) ".."))
+ (branch
+ (let ((current (magit-get-current-branch))
+ (atpoint (magit-section-value it))
+ (upstream (magit-get-upstream-branch))
+ (push (magit-get-push-branch)))
+ (cond ((equal atpoint current)
+ (and upstream (concat upstream "..")))
+ ((equal atpoint push)
+ (concat push ".."))
+ (t
+ (concat ".." atpoint))))))
+ (--when-let (and (derived-mode-p 'magit-revision-mode)
+ (car magit-refresh-args))
+ (and (magit-rev-verify (concat it "^2"))
+ (concat it "^-1"))))))
(if range
(magit-log (list range) args files)
(call-interactively #'magit-log))))