VC-Git: Pass --no-optional-locks

* lisp/vc/vc-git.el (vc-git--no-optional-locks): New function.
(vc-git-command, vc-git--call): Use it.
This commit is contained in:
Sean Whitton 2026-08-05 14:33:34 +01:00
parent ed1a2e8239
commit bc92224c5f

View file

@ -2899,6 +2899,13 @@ page for the meanings of these attributes."
(equal subcommand "status"))
'("GIT_OPTIONAL_LOCKS=0"))))
;; This is for the same purpose as `vc-git--env-vars' except that it
;; covers older Git, which doesn't recognise the environment variable.
(defun vc-git--no-optional-locks (subcommand)
(and (or revert-buffer-in-progress
(equal subcommand "status"))
'("--no-optional-locks")))
(defun vc-git-command (buffer okstatus file-or-list &rest flags)
"A wrapper around `vc-do-command' for use in vc-git.el.
The difference to `vc-do-command' is that this function always invokes
@ -2944,7 +2951,9 @@ The difference to `vc-do-command' is that this function always invokes
".")
((not file-list-is-rootdir)
file-or-list))
(cons "--no-pager" flags))))
(cons "--no-pager"
(append (vc-git--no-optional-locks (car flags))
flags)))))
(defun vc-git--empty-db-p ()
"Check if the git db is empty (no commit done yet)."
@ -2964,7 +2973,9 @@ The difference to `vc-do-command' is that this function always invokes
(process-environment (append (vc-git--env-vars command)
process-environment)))
(apply #'process-file vc-git-program infile buffer nil
"--no-pager" command args)))
(cons "--no-pager"
(append (vc-git--no-optional-locks command)
(cons command args))))))
(defun vc-git--out-ok (command &rest args)
"Run `git COMMAND ARGS...' and insert standard output in current buffer.