Subject: bug#21559: 25.0.50; auto-revert-mode breaks git rebase

From: Jason Merrill <[email-masked]>
Date: Fri, 9 Sep 2016 16:56:23 -0400

The problematic invocation of git status comes from

(defun vc-git-conflicted-files (directory)
  "Return the list of files with conflicts in DIRECTORY."
  (let* ((status
          (vc-git--run-command-string directory "status" "--porcelain"
"--"))

I'm working around this issue by changing vc-git-conflicted-files to use
diff-files --name-status, which doesn't lock the index:

(defun vc-git-conflicted-files (directory)
  "Return the list of files with conflicts in DIRECTORY."
  (let* ((status
          (vc-git--run-command-string directory "diff-files"
"--name-status"))
         (lines (when status (split-string status "\n" 'omit-nulls)))
         files)
    ;; TODO: Look into reimplementing `vc-git-state', as well as

    ;; `vc-git-dir-status-files', based on this output, thus making the

    ;; extra process call in `vc-git-find-file-hook' unnecessary.

    (dolist (line lines files)
      (when (string-match "\\([ MADRCU?!]\\)[ \t]+\\(.+\\)" line)
        (let ((state (match-string 1 line))
              (file (match-string 2 line)))
          ;; See git-status(1).

          (when (equal state "U")
            (push (expand-file-name file directory) files)))))))