emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 692b2db78a: magit-{branch-or-, }commit-at-point


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 692b2db78a: magit-{branch-or-, }commit-at-point: Consider removal blame chunks
Date: Wed, 4 Jan 2023 21:59:00 -0500 (EST)

branch: elpa/git-commit
commit 692b2db78a5e92dd8fac7c67033598da21b29ed4
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    magit-{branch-or-,}commit-at-point: Consider removal blame chunks
    
    magit-commit-at-point and magit-branch-or-commit-at-point extract the
    commit from a blame chunk with
    
      (magit-current-blame-chunk 'addition t)
    
    For a magit-blame-reverse chunk, 'git blame' is called again to get an
    'addition' chunk, leading to the returned commit confusingly not
    matching the chunk's commit.  A downstream consequence of this is that
    magit-show-commit displays the addition commit for a removal chunk
    (while magit-diff-show-or-scroll-up shows the expected removal commit,
    because it doesn't rely on magit-branch-or-commit-at-point).
    
    As of 4b8eab3a (magit-{branch-or,}commit-at-point: Only use blame
    chunk when blaming, 2022-05-27), magit-commit-at-point and
    magit-branch-or-commit-at-point invoke magit-current-blame-chunk only
    when Blame mode is enabled, so it's safe to assume that there is an
    existing blame chunk.  Rely on it to get the appropriate commit.
    
    Fixes #4834.
---
 docs/RelNotes/3.4.0.org | 3 +++
 lisp/magit-git.el       | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/docs/RelNotes/3.4.0.org b/docs/RelNotes/3.4.0.org
index 9169af1675..b0f4b2310e 100644
--- a/docs/RelNotes/3.4.0.org
+++ b/docs/RelNotes/3.4.0.org
@@ -193,6 +193,9 @@ a66b86d511 Define empty face definitions without making 
them rogue
   (e.g., ~magit-checkout~) erroring when called from a Dired buffer.
   #4560
 
+- ~magit-show-commit~ showed the incorrect commit when called on a
+  chunk generated by ~magit-blame-reverse~.  #4834
+
 fa620ed3e4 4557 magit-convert-filename-for-git: Fix for Tramp in Windows
 
 - For Helm users, calling ~magit-stash-drop~ on the "Stashes" section
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index b0cd08a0b9..141ca8557b 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1528,7 +1528,7 @@ to, or to some other symbolic-ref that points to the same 
ref."
       (magit-thing-at-point 'git-revision t)
       (and-let* ((chunk (and (bound-and-true-p magit-blame-mode)
                              (fboundp 'magit-current-blame-chunk)
-                             (magit-current-blame-chunk 'addition t))))
+                             (magit-current-blame-chunk))))
         (oref chunk orig-rev))
       (and (derived-mode-p 'magit-stash-mode
                            'magit-merge-preview-mode
@@ -1550,7 +1550,7 @@ to, or to some other symbolic-ref that points to the same 
ref."
       (magit-thing-at-point 'git-revision t)
       (and-let* ((chunk (and (bound-and-true-p magit-blame-mode)
                              (fboundp 'magit-current-blame-chunk)
-                             (magit-current-blame-chunk 'addition t))))
+                             (magit-current-blame-chunk))))
         (oref chunk orig-rev))
       (and magit-buffer-file-name
            magit-buffer-refname)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]