From 5265d04f908cdcab12b24402221b18d83fab1f43 Mon Sep 17 00:00:00 2001 From: Alexei Khlebnikov Date: Mon, 19 Feb 2018 19:07:58 +0100 Subject: [PATCH v2] Fix for: "25.0.50; auto-revert-mode breaks git rebase" (Bug#21559) * lisp/vc/vc-git.el (vc-git-state, vc-git-conflicted-files): Prepend "GIT_OPTIONAL_LOCKS=0" to process-environment when doing "git status". --- lisp/vc/vc-git.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 47172dd52f..35cb7defca 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -291,14 +291,17 @@ vc-git-state ;; corresponding upstream branch, and the file was modified ;; upstream. We'd need to check against the upstream tracking ;; branch for that (an extra process call or two). - (let* ((args + (let* (;; Avoid repository locking during "git status" (bug#21559). + (process-environment + (cons "GIT_OPTIONAL_LOCKS=0" process-environment)) + (args `("status" "--porcelain" "-z" ;; Just to be explicit, it's the default anyway. "--untracked-files" ,@(when (version<= "1.7.6.3" (vc-git--program-version)) '("--ignored")) "--")) - (status (apply #'vc-git--run-command-string file args))) + (status (apply #'vc-git--run-command-string file args))) ;; Alternatively, the `ignored' state could be detected with 'git ;; ls-files -i -o --exclude-standard', but that's an extra process ;; call, and the `ignored' state is rarely needed. @@ -939,7 +942,10 @@ vc-git-merge-branch (defun vc-git-conflicted-files (directory) "Return the list of files with conflicts in DIRECTORY." - (let* ((status + (let* (;; Avoid repository locking during "git status" (bug#21559). + (process-environment + (cons "GIT_OPTIONAL_LOCKS=0" process-environment)) + (status (vc-git--run-command-string directory "status" "--porcelain" "--")) (lines (when status (split-string status "\n" 'omit-nulls))) files) -- 2.15.1