fix magit update

This commit is contained in:
2022-01-27 17:13:55 +01:00
parent 03507476ec
commit b6f0853efe
28 changed files with 13645 additions and 11087 deletions

View File

@@ -1010,6 +1010,16 @@ one trailing newline is added."
(and (eq trim ?\n) "\n"))
str)))
(defun magit--version> (v1 v2)
"Return t if version V1 is higher (younger) than V2.
This function should be named `version>' and be part of Emacs."
(version-list-< (version-to-list v2) (version-to-list v1)))
(defun magit--version>= (v1 v2)
"Return t if version V1 is higher (younger) than or equal to V2.
This function should be named `version>=' and be part of Emacs."
(version-list-<= (version-to-list v2) (version-to-list v1)))
;;; Kludges for Emacs Bugs
(defun magit-file-accessible-directory-p (filename)
@@ -1019,7 +1029,7 @@ and https://github.com/magit/magit/issues/2295."
(and (file-directory-p filename)
(file-accessible-directory-p filename)))
(when (version<= "25.1" emacs-version)
(when (magit--version>= emacs-version "25.1")
(with-eval-after-load 'vc-git
(defun vc-git-conflicted-files (directory)
"Return the list of files with conflicts in DIRECTORY."
@@ -1158,6 +1168,9 @@ or (last of all) the value of EXP."
(advice-add 'Info-follow-nearest-node :around
'Info-follow-nearest-node--magit-gitman)
;; When making changes here, then also adjust the copy in docs/Makefile.
;;;###autoload
(advice-add 'org-man-export :around 'org-man-export--magit-gitman)
;;;###autoload
(defun org-man-export--magit-gitman (fn link description format)
(if (and (eq format 'texinfo)
@@ -1177,10 +1190,6 @@ the %s(1) manpage.
")
(funcall fn link description format)))
;;;###autoload
(advice-add 'org-man-export :around
'org-man-export--magit-gitman)
;;; Kludges for Package Managers
(defun magit--straight-chase-links (filename)
@@ -1198,6 +1207,32 @@ See <https://github.com/raxod502/straight.el/issues/520>."
(setq filename target))))
(file-chase-links filename))
;;; Kludges for older Emacs versions
(if (fboundp 'with-connection-local-variables)
(defalias 'magit--with-connection-local-variables
'with-connection-local-variables)
(defmacro magit--with-connection-local-variables (&rest body)
"Abridged `with-connection-local-variables' for pre Emacs 27 compatibility.
Bind shell file name and switch for remote execution.
`with-connection-local-variables' isn't available until Emacs 27.
This kludge provides the minimal functionality required by
Magit."
`(if (file-remote-p default-directory)
(pcase-let ((`(,shell-file-name ,shell-command-switch)
(with-no-warnings ; about unknown tramp functions
(require 'tramp)
(let ((vec (tramp-dissect-file-name
default-directory)))
(list (tramp-get-method-parameter
vec 'tramp-remote-shell)
(mapconcat #'identity
(tramp-get-method-parameter
vec 'tramp-remote-shell-args)
" "))))))
,@body)
,@body)))
;;; Miscellaneous
(defun magit-message (format-string &rest args)