mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 15:56:35 -04:00
Export GIT_OPTIONAL_LOCKS=0 for "git status" invocations (bug#80903)
* lisp/vc/vc-git.el (vc-git--env-vars): New function. (vc-git-command, vc-git--call): Use it (bug#80903).
This commit is contained in:
parent
8e70e6d687
commit
a9fc13614e
|
|
@ -2884,6 +2884,21 @@ page for the meanings of these attributes."
|
|||
|
||||
;;; Internal commands
|
||||
|
||||
(defun vc-git--env-vars (subcommand)
|
||||
"Return env vars for the `process-environment' of Git processes."
|
||||
`("GIT_DIR"
|
||||
,@(and vc-git-use-literal-pathspecs
|
||||
'("GIT_LITERAL_PATHSPECS=1"))
|
||||
;; Avoid optional repository locking during background operations
|
||||
;; (bug#21559, bug#80903). Skipping these locks is always safe and
|
||||
;; can only lead to subsequent commands running more slowly.
|
||||
;; The "git status" case covers how `vc-checkin' uses
|
||||
;; `vc-dir-resynch-file' to update the display state of files
|
||||
;; undergoing an asynchronous check-in.
|
||||
,@(and (or revert-buffer-in-progress
|
||||
(equal subcommand "status"))
|
||||
'("GIT_OPTIONAL_LOCKS=0"))))
|
||||
|
||||
(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
|
||||
|
|
@ -2903,16 +2918,8 @@ The difference to `vc-do-command' is that this function always invokes
|
|||
;; want to do it only for commands which really require it.
|
||||
(coding-system-for-write
|
||||
(or coding-system-for-write vc-git-commits-coding-system))
|
||||
(process-environment
|
||||
(append
|
||||
`("GIT_DIR"
|
||||
,@(and vc-git-use-literal-pathspecs
|
||||
'("GIT_LITERAL_PATHSPECS=1"))
|
||||
;; Avoid repository locking during background operations
|
||||
;; (bug#21559).
|
||||
,@(and revert-buffer-in-progress
|
||||
'("GIT_OPTIONAL_LOCKS=0")))
|
||||
process-environment))
|
||||
(process-environment (append (vc-git--env-vars (car flags))
|
||||
process-environment))
|
||||
(file1 (and (not (cdr-safe file-or-list))
|
||||
(or (car-safe file-or-list) file-or-list)))
|
||||
(file-list-is-rootdir (and file1
|
||||
|
|
@ -2954,16 +2961,8 @@ The difference to `vc-do-command' is that this function always invokes
|
|||
(or coding-system-for-read vc-git-log-output-coding-system))
|
||||
(coding-system-for-write
|
||||
(or coding-system-for-write vc-git-commits-coding-system))
|
||||
(process-environment
|
||||
(append
|
||||
`("GIT_DIR"
|
||||
,@(when vc-git-use-literal-pathspecs
|
||||
'("GIT_LITERAL_PATHSPECS=1"))
|
||||
;; Avoid repository locking during background operations
|
||||
;; (bug#21559).
|
||||
,@(when revert-buffer-in-progress
|
||||
'("GIT_OPTIONAL_LOCKS=0")))
|
||||
process-environment)))
|
||||
(process-environment (append (vc-git--env-vars command)
|
||||
process-environment)))
|
||||
(apply #'process-file vc-git-program infile buffer nil
|
||||
"--no-pager" command args)))
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue