[Top][All Lists]

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

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

From: Jonathan Ganc
Subject: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Tue, 11 Apr 2017 09:08:35 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

I think I've changed my mind about where/whether to bind default-directory. Since it is not universally bound by all vcs engines, it should probably be considered "backend specific", which would therefore suggest that it not be bound before the backend specific functions, e.g. vc-git-state. On the other hand, since it sometimes is necessary for correct output, I do think it should be bound in vc-git-state.

On 04/10/2017 11:52 PM, Jonathan Ganc wrote:

The binding affects the output if default-directory is not set inside the file's repository.

Since, in principle, the vc functions should be agnostic to the choice of vcs, either a) vc-state documentation should state that default-directory should be set to get generally correct responses or b) it should be set in some function (and I agree that vc-state-refresh makes sense).

I think the overhead of setting the directory is rather low. In some admittedly rudimentary benchmarks, there is almost no difference in performance setting default-directory.

There's also the question of how to handle default-directory. You cannot simply do (file-name-directory file), because that fails if FILE is given without a directory. I think the correct one is (file-name-directory (expand-file-name file)) (which, surprisingly, is slighly faster than (file-name-directory (concat default-directory file)) ).

reply via email to

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