Function: majutsu-diff--git-header-paths-match-p
majutsu-diff--git-header-paths-match-p is a natively compiled function
defined in majutsu-diff.el.
Signature
(majutsu-diff--git-header-paths-match-p HEADER ENTRY)
Documentation
Return non-nil when Git diff HEADER paths match structured ENTRY.
ENTRY remains the source of truth; this only rejects a stale or reordered metadata result.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-diff.el
(defun majutsu-diff--git-header-paths-match-p (header entry)
"Return non-nil when Git diff HEADER paths match structured ENTRY.
ENTRY remains the source of truth; this only rejects a stale or reordered
metadata result."
(let* ((header (or header ""))
(left (concat "a/" (plist-get entry :source)))
(right (concat "b/" (plist-get entry :target)))
(raw (concat left " " right)))
(or (string-prefix-p (concat "diff --git " raw "\n") header)
(when-let* ((line (car (split-string header "\n")))
((string-prefix-p "diff --git " line)))
(let ((payload (string-remove-prefix "diff --git " line)))
(or (equal payload raw)
;; If the left token is raw, its exact structured value tells us
;; where the otherwise ambiguous separator must be.
(and (string-prefix-p (concat left " ") payload)
(majutsu-diff--git-token-matches-p
(substring payload (1+ (length left))) right))
;; A quoted left token is self-delimiting; decode it and validate the
;; complete remaining token independently.
(and (string-prefix-p "\"" payload)
(pcase (majutsu-diff--read-git-quoted-token payload)
(`(,value . ,end)
(and (equal value left)
(< end (length payload))
(= (aref payload end) ?\s)
(majutsu-diff--git-token-matches-p
(substring payload (1+ end)) right)))))))))))