Function: magit-git-string-ng
magit-git-string-ng is a byte-compiled function defined in
magit-git.el.
Signature
(magit-git-string-ng &rest ARGS)
Documentation
Execute Git with ARGS, returning the first line of its output.
If the exit code isn't zero or if there is no output, then that is considered an error, but instead of actually signaling an error, return nil. Additionally the output is put in the process buffer (creating it if necessary) and the error message is shown in the status buffer (provided it exists).
This is an experimental replacement for magit-git-string, and
still subject to major changes.
Source Code
;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-git-string-ng (&rest args)
"Execute Git with ARGS, returning the first line of its output.
If the exit code isn't zero or if there is no output, then that
is considered an error, but instead of actually signaling an
error, return nil. Additionally the output is put in the process
buffer (creating it if necessary) and the error message is shown
in the status buffer (provided it exists).
This is an experimental replacement for `magit-git-string', and
still subject to major changes."
(magit--with-refresh-cache
(list default-directory 'magit-git-string-ng args)
(magit--with-temp-process-buffer
(let* ((args (magit-process-git-arguments args))
(status (magit-process-git t args)))
(if (zerop status)
(and (not (bobp))
(progn
(goto-char (point-min))
(buffer-substring-no-properties
(point) (line-end-position))))
(let ((buf (current-buffer)))
(with-current-buffer (magit-process-buffer t)
(magit-process-insert-section default-directory
magit-git-executable args
status buf
'magit-section-secondary-heading)))
(when-let ((status-buf (magit-get-mode-buffer 'magit-status-mode)))
(let ((msg (magit--locate-error-message)))
(with-current-buffer status-buf
(setq magit-this-error msg))))
nil)))))