Subject: bug#26066: 26.0.50; vc-git-status gives wrong result

From: Dmitry Gutov <[email-masked]>
Date: Wed, 22 Mar 2017 18:20:04 +0200

On 21.03.2017 18:10, Jonathan Ganc wrote:

> Well, the ideal situation is if could get a listing like the one atom 
> has for projects, where you get a visual view of directories and can see 
> folders with changed files as well as the status of files (orangish 
> means modified, green means new, greyed means ignored):
> 
> http://imgur.com/a/PiiGF
> 
> Actually, emacs has something not so dissimilar in the Neotree package. 
> (Install it and use `(setq neo-vc-integration '(face char))` ). It has a 
> few shortcomings:
> 
> 1. Because of this bug, it was giving me the wrong status for files, 
> i.e. they showed up wrong. That is how I noticed the bug in the first 
> place.

I see, thanks. Neotree does have an optional feature that colors the 
tree leaves according to their VC statuses.

The problem might have gone unnoticed until now because file's status is 
cached, and because it can only be apparent if several projects are 
opened at the same time.

While the problem is fairly obvious, a proper fix would most likely 
touch other backends and commands, to the point that the 
default-directory binding might have to be done inside vc-call-backend.

There is a very simple workaround on the caller's side, though: bind 
default-directory inside the Neotree code, to the respective project 
root (or just the file's parent directory). That will be necessary 
anyway for it to work in the released Emacs versions.

> 2. I would like to be able to color directories as well as files. I 
> don't know if that is something that would have a component in vc-git.el 
> / vc-....el or would go entirely in some package (e.g. Neotree)

This differs from one version control system to another, but Git doesn't 
actually track directories. So the notion of "directory status" is 
poorly defined. But see the previously mentioned diff-hl-dired-mode.

> 3. It would be nice to be able to show mutiple directory trees at once 
> in Neotree, though this is not as important.

If it's unable to show the non-current projects, how is the bug 
triggered? default-directory would have to be outside of the project.