Function: magit-git-config-p

magit-git-config-p is a byte-compiled function defined in magit-git.el.

Signature

(magit-git-config-p VARIABLE &optional DEFAULT)

Documentation

Return the boolean value of the Git variable VARIABLE.

VARIABLE has to be specified as a string. If VARIABLE is unset, return nil by default, unless DEFAULT is non-nil, in which case return t. Signal an error if VARIABLE is set but not a boolean.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-git-config-p (variable &optional default)
  "Return the boolean value of the Git variable VARIABLE.
VARIABLE has to be specified as a string.  If VARIABLE is unset,
return nil by default, unless DEFAULT is non-nil, in which case
return t.  Signal an error if VARIABLE is set but not a boolean."
  (let ((args (list "config" "--bool" "--default" (if default "true" "false")
                    variable)))
    (magit--with-refresh-cache (cons default-directory args)
      (magit--with-temp-process-buffer
        (let ((status (magit-process-git t args))
              (output (buffer-substring (point-min) (1- (point-max)))))
          (if (zerop status)
              (equal output "true")
            (signal 'magit-invalid-git-boolean (list output))))))))