emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 77fe255 1/2: vc-git-after-dir-status-stage: Avoid erroneous up-to


From: Dmitry Gutov
Subject: master 77fe255 1/2: vc-git-after-dir-status-stage: Avoid erroneous up-to-date status
Date: Mon, 16 Dec 2019 18:51:23 -0500 (EST)

branch: master
commit 77fe255d90c74a43aa46c475a34a5a4055f7a4b6
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    vc-git-after-dir-status-stage: Avoid erroneous up-to-date status
    
    * lisp/vc/vc-git.el (vc-git-after-dir-status-stage):
    Don't set `up-to-date' status if the previous stage (`diff-index')
    has assigned some other status to the file (bug#38615).
---
 lisp/vc/vc-git.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 71307cd..021b48a 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -521,14 +521,19 @@ or an empty string if none."
       ('ls-files-up-to-date
        (setq next-stage 'ls-files-unknown)
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 
\\([0-3]\\)\t\\([^\0]+\\)\0" nil t)
-         (let ((perm (string-to-number (match-string 1) 8))
-               (state (match-string 2))
-               (name (match-string 3)))
-           (vc-git-dir-status-update-file
-            git-state name (if (equal state "0")
-                               'up-to-date
-                             'conflict)
-            (vc-git-create-extra-fileinfo perm perm)))))
+         (let* ((perm (string-to-number (match-string 1) 8))
+                (state (match-string 2))
+                (name (match-string 3))
+                (file-info (vc-git-create-extra-fileinfo perm perm)))
+           (if (equal state "0")
+               (unless (gethash name (vc-git-dir-status-state->hash git-state))
+                 ;; `diff-index' stage has not produced a more precise info.
+                 (vc-git-dir-status-update-file
+                  git-state name 'up-to-date file-info))
+             ;; `diff-index' assigns `edited' status to conflicted
+             ;; files, so we can't do the above in both cases.
+             (vc-git-dir-status-update-file
+              git-state name 'conflict file-info)))))
       ('ls-files-conflict
        (setq next-stage 'ls-files-unknown)
        ;; It's enough to look for "3" to notice a conflict.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]