From: Dmitry Gutov <dgutov@yandex.ru>
To: Andrii Kolomoiets <andreyk.mad@gmail.com>, 38615@debbugs.gnu.org
Subject: bug#38615: 27.0.50; vc-git: Wrong status in vc-dir after registering directory
Date: Mon, 16 Dec 2019 03:25:00 +0200 [thread overview]
Message-ID: <c86d0bad-f344-11fb-e976-81e9f3f11099@yandex.ru> (raw)
In-Reply-To: <m2k16zhyfs.fsf@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
Hi Andrii,
On 14.12.2019 14:41, Andrii Kolomoiets wrote:
> 0. mkdir test && cd test
> git init
> touch file
> git add file
> git commit -m "initial"
> mkdir dir
> touch dir/file1
> 1. emacs -Q
> 2. C-x v d
> "dir/" is listed with "unregistered" status.
> 3. v
> "dir/" has "added" status.
> 4. g
> "dir/file1" is listed with "up-to-date" status. Shouldn't it have
> "added" status?
> 5. g
> Now "dir/file1" properly has "added" status.
>
> Also:
> - After step 3 point is moved to word "dir" on second line.
> - Press "n" before step 3 to move point to "dir/". After step 3 "dir/"
> status is not updated and remains "unregistered".
Thanks for the repro. This problem seems to have been with us for a while.
vc-git's dir-status-files code is a bit hard to follow, but here's a
patch you can try. I'll commit it in the next few days if nothing comes up.
[-- Attachment #2: vc-git-dir-status-files+added.diff --]
[-- Type: text/x-patch, Size: 1488 bytes --]
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 71307cdffd..9e02a820ac 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -521,14 +521,17 @@ vc-git-after-dir-status-stage
('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' has not produced a more precise info.
+ (vc-git-dir-status-update-file
+ git-state name 'up-to-date file-info))
+ (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.
next prev parent reply other threads:[~2019-12-16 1:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-14 12:41 bug#38615: 27.0.50; vc-git: Wrong status in vc-dir after registering directory Andrii Kolomoiets
2019-12-16 1:25 ` Dmitry Gutov [this message]
2019-12-16 8:00 ` Andrii Kolomoiets
2019-12-16 13:23 ` Dmitry Gutov
2019-12-16 19:43 ` Andrii Kolomoiets
2019-12-16 23:53 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c86d0bad-f344-11fb-e976-81e9f3f11099@yandex.ru \
--to=dgutov@yandex.ru \
--cc=38615@debbugs.gnu.org \
--cc=andreyk.mad@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.