diff options
author | Kyle Meyer <kyle@kyleam.com> | 2018-07-30 18:13:31 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2018-07-30 18:13:31 -0400 |
commit | a34de3d7eeb265667d0819ac196c2adbddb5e671 (patch) | |
tree | 3d9950541eb19c75fc63c3917d7137949a38aa51 /lisp | |
parent | d51dde5af1971735ba0a565c2b0c27b86e4d229b (diff) | |
download | emacs.d-a34de3d7eeb265667d0819ac196c2adbddb5e671.tar.gz |
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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/km-magit.el | 17 |
1 files changed, 5 insertions, 12 deletions
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) |