summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-magit.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index d8972ba..0c4a344 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -623,6 +623,29 @@ argument. Interactively, this can be accessed using the command
'git-commit-flyspell-verify)
(turn-on-flyspell))
+(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))))))))
+ (if range
+ (magit-log (list range) args files)
+ (call-interactively #'magit-log))))
+
;;; Git Rebase mode