Function: magit-config-get-from-cached-list

magit-config-get-from-cached-list is a byte-compiled function defined in magit-git.el.

Signature

(magit-config-get-from-cached-list KEY)

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
;;; Variables

(defun magit-config-get-from-cached-list (key)
  (gethash
   ;; `git config --list' downcases first and last components of the key.
   (let* ((key (replace-regexp-in-string "\\`[^.]+" #'downcase key t t))
          (key (replace-regexp-in-string "[^.]+\\'" #'downcase key t t)))
     key)
   (magit--with-refresh-cache (cons (magit-toplevel) 'config)
     (let ((configs (make-hash-table :test #'equal)))
       (dolist (conf (magit-git-items "config" "--list" "-z"))
         (let* ((nl-pos (cl-position ?\n conf))
                (key (substring conf 0 nl-pos))
                (val (if nl-pos (substring conf (1+ nl-pos)) "")))
           (puthash key (nconc (gethash key configs) (list val)) configs)))
       configs))))