Function: magit--chase-links
magit--chase-links is a byte-compiled function defined in
magit-base.el.
Signature
(magit--chase-links FILENAME)
Documentation
Chase links in FILENAME until a name that is not a link.
This is the same as file-chase-links, except that it also handles
fake symlinks that are created by some source based package managers
(Elpaca and Straight) on Windows.
See <https://github.com/raxod502/straight.el/issues/520>.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-base.el
;;; Kludges for Package Managers
(defun magit--chase-links (filename)
"Chase links in FILENAME until a name that is not a link.
This is the same as `file-chase-links', except that it also handles
fake symlinks that are created by some source based package managers
\(Elpaca and Straight) on Windows.
See <https://github.com/raxod502/straight.el/issues/520>."
(when-let*
((manager (cond ((bound-and-true-p straight-symlink-mode) 'straight)
((bound-and-true-p elpaca-no-symlink-mode) 'elpaca)))
(build (pcase manager
('straight (bound-and-true-p straight-build-dir))
('elpaca (bound-and-true-p elpaca-builds-directory))))
(_(string-prefix-p build filename))
(repo (pcase manager
('straight
(and (bound-and-true-p straight-base-dir)
(expand-file-name "repos/magit/lisp/" straight-base-dir)))
('elpaca
(and (bound-and-true-p elpaca-repos-directory)
(expand-file-name "magit/lisp/" elpaca-repos-directory))))))
(setq filename (expand-file-name (file-name-nondirectory filename) repo)))
(file-chase-links filename))