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

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

[nongnu] elpa/git-commit 1d4bf64f33: magit-insert-remote-branches: Fix G


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 1d4bf64f33: magit-insert-remote-branches: Fix Git 2.40 compatibility
Date: Wed, 15 Mar 2023 23:00:14 -0400 (EDT)

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

    magit-insert-remote-branches: Fix Git 2.40 compatibility
    
    If magit-insert-remote-branches sees a remote HEAD line in the
    for-each-ref output, it notes what value the symref points to so that
    it can mark that branch with magit-branch-remote-head.  Before storing
    the value, it asserts that the refname:short value for the line
    matches the expected value, "<remote>/HEAD".
    
    This assertion fails as of Git's 613bef56b8
    (shorten_unambiguous_ref(): avoid sscanf(), 2023-02-15), part of the
    v2.40.0 release.  "refs/remotes/<remote>/HEAD" is now shortened to
    "<remote>" rather than "<remote>/HEAD", matching the fallback behavior
    described in 'man gitrevisions'.
    
    Switch the assertion over to using the full reference to make it
    compatible with Git versions before and after v2.40.0.
    
    Closes #4903.
---
 lisp/magit-refs.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el
index a7ffd2d22d..9ecbd23e19 100644
--- a/lisp/magit-refs.el
+++ b/lisp/magit-refs.el
@@ -572,7 +572,12 @@ line is inserted at all."
           (pcase-let ((`(,head-branch ,branch ,ref ,msg)
                        (-replace "" nil (split-string line "\0"))))
             (if head-branch
-                (progn (cl-assert (equal branch (concat remote "/HEAD")))
+                ;; Note: Use `ref' instead of `branch' for the check
+                ;; below because 'refname:short' shortens the remote
+                ;; HEAD to '<remote>' instead of '<remote>/HEAD' as of
+                ;; Git v2.40.0.
+                (progn (cl-assert
+                        (equal ref (concat "refs/remotes/" remote "/HEAD")))
                        (setq head head-branch))
               (when (magit-refs--insert-refname-p branch)
                 (magit-insert-section (branch branch t)



reply via email to

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