Skip to content

Commit 77fe255

Browse files
committed
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).
1 parent 1e240a0 commit 77fe255

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lisp/vc/vc-git.el

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -521,14 +521,19 @@ or an empty string if none."
521521
('ls-files-up-to-date
522522
(setq next-stage 'ls-files-unknown)
523523
(while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} \\([0-3]\\)\t\\([^\0]+\\)\0" nil t)
524-
(let ((perm (string-to-number (match-string 1) 8))
525-
(state (match-string 2))
526-
(name (match-string 3)))
527-
(vc-git-dir-status-update-file
528-
git-state name (if (equal state "0")
529-
'up-to-date
530-
'conflict)
531-
(vc-git-create-extra-fileinfo perm perm)))))
524+
(let* ((perm (string-to-number (match-string 1) 8))
525+
(state (match-string 2))
526+
(name (match-string 3))
527+
(file-info (vc-git-create-extra-fileinfo perm perm)))
528+
(if (equal state "0")
529+
(unless (gethash name (vc-git-dir-status-state->hash git-state))
530+
;; `diff-index' stage has not produced a more precise info.
531+
(vc-git-dir-status-update-file
532+
git-state name 'up-to-date file-info))
533+
;; `diff-index' assigns `edited' status to conflicted
534+
;; files, so we can't do the above in both cases.
535+
(vc-git-dir-status-update-file
536+
git-state name 'conflict file-info)))))
532537
('ls-files-conflict
533538
(setq next-stage 'ls-files-unknown)
534539
;; It's enough to look for "3" to notice a conflict.

0 commit comments

Comments
 (0)