From a34de3d7eeb265667d0819ac196c2adbddb5e671 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 30 Jul 2018 18:13:31 -0400 Subject: Tweak and simplify km/magit-rev-ancestor-p Don't assume that the question of interest is usually whether the revision at point is the descendant. --- lisp/km-magit.el | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'lisp') diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 2d04786..9dfefb3 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -499,19 +499,12 @@ argument." (kill-new (message it)))) (defun km/magit-rev-ancestor-p (rev-a rev-b) - "Report whether REV-A is the ancestor of REV-B. -Use the revision at point as REV-B. With a prefix argument or if -there is no revision at point, prompt for the revision. Always -prompt for REV-A." + "Report whether REV-A is the ancestor of REV-B." (interactive - (let* ((atpoint (or (and magit-blame-mode (magit-blame-chunk-get :hash)) - (magit-branch-or-commit-at-point) - (magit-tag-at-point))) - (commit (or (and (not current-prefix-arg) atpoint) - (magit-read-branch-or-commit "Descendant" atpoint)))) - (list (magit-read-other-branch-or-commit - (format "Test if ancestor of %s" commit) commit) - commit))) + (let* ((rev-a (magit-read-branch-or-commit "Ancestor candidate"))) + (list rev-a (magit-read-other-branch-or-commit + (format "Is %s the ancestor of" rev-a) + rev-a)))) (message "%s is %san ancestor of %s" rev-a (if (magit-git-success "merge-base" "--is-ancestor" rev-a rev-b) -- cgit v1.2.3