]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix for: "25.0.50; auto-revert-mode breaks git rebase" (Bug#21559)
authorAlexei Khlebnikov <alexei.khlebnikov@gmail.com>
Thu, 22 Feb 2018 11:21:49 +0000 (12:21 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Thu, 22 Feb 2018 11:21:49 +0000 (12:21 +0100)
* lisp/autorevert.el (auto-revert-handler):
Set "revert-buffer-in-progress-p" flag before calling
"vc-refresh-state".

* lisp/vc/vc-git.el (vc-git-command):
If "revert-buffer-in-progress-p" flag is set, prepend
"GIT_OPTIONAL_LOCKS=0" to "process-environment".  (Bug#21559)

lisp/autorevert.el
lisp/vc/vc-git.el

index cf145e0ee389a04afd0b79528b3727d73bb6ec95..0a9d3bef546d9d5e171e51c93ce9c7f270e36268 100644 (file)
@@ -709,7 +709,8 @@ This is an internal function used by Auto-Revert Mode."
     ;; `preserve-modes' avoids changing the (minor) modes.  But we do
     ;; want to reset the mode for VC, so we do it manually.
     (when (or revert auto-revert-check-vc-info)
-      (vc-refresh-state))))
+      (let ((revert-buffer-in-progress-p t))
+        (vc-refresh-state)))))
 
 (defun auto-revert-tail-handler (size)
   (let ((modified (buffer-modified-p))
index 26af99805d0ade4bc87fc2bc29fd82eba75d8137..163333af3ba69124545050cd7739f3b53d42fd97 100644 (file)
@@ -1569,7 +1569,14 @@ 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 (cons "GIT_DIR" process-environment)))
+        (process-environment
+         (append
+          `("GIT_DIR"
+            ;; Avoid repository locking during background operations
+            ;; (bug#21559).
+            ,@(when revert-buffer-in-progress-p
+                '("GIT_OPTIONAL_LOCKS=0")))
+          process-environment)))
     (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program
           ;; https://debbugs.gnu.org/16897
           (unless (and (not (cdr-safe file-or-list))