GNU bug report logs - #26066
vc-git-status gives wrong result when called from outside repository

Previous Next

Package: emacs;

Reported by: Jonathan Ganc <jonganc <at> gmail.com>

Date: Sun, 12 Mar 2017 02:45:02 UTC

Severity: minor

Tags: patch

Found in versions 25.2, 26.0.50, 24.5

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #123 received at 26066 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Jonathan Ganc <jonganc <at> gmail.com>, npostavs <at> users.sourceforge.net,
 26066 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Mon, 1 May 2017 04:57:33 +0300
On 14.04.2017 3:42, Jonathan Ganc wrote:
> First, I'm sorry for this delayed response. I've had a busy few days 
> (and I needed to think about the issue)!

I'm sorry about the delay as well.

> I'm fine with decoupling the question about default-directory from the 
> patch for git status. I have attached a patch that does not bind 
> default-directory. (And I now have turned in the assignment paperwork to 
> the FSF!).

Thanks! That part is applied now.

>> If vc-git supports calling vc-git-state from outside of the 
>> repository, but not some other commands, or if vc-git-state does but 
>> some other backends' vc-xx-state does not, this will increase 
>> inconsistency and make it harder for the programmers to write 
>> VCS-agnostic code, which is one of the main goals of VC.
> 
> But being vcs-agnostic is more for people who use vc-state or 
> vc-state-refresh, rather than people actually writing the vc-specific 
> functions, no?

The vc-specific functions are supposed to conform to the common 
interface. To be as indistinguishable as feasible.

> If this bug is unchanged, people using vc-state have to 
> ask themselves: "if the backend is git, I have to bind default-directory 
> but if it's not, I don't." That is inconsistent with vc agnosticism.

If that was only the Git backend's problem, I might have agreed.

However, not all other backends bind default-directory. Bzr doesn't, as 
one example. Hg and SVN seem to do that, though. If you have a chance to 
experiment with some other popular ones, please do.

But what about the problems like "I don't have to bind default-directory 
when calling vc-state, but I still have to do that when calling other 
backend commands"?

> That's a valid question and a valid point. But I actually think that 
> adding the binding in vc-git-state furthers the goal of systematically 
> answering them.

Since we'll have to hunt down every other command that needs it (or, 
worse, wait for bug reports and thus spread that effort across several 
Emacs releases), I'm not so sure it would be a great step.

> I doubt we'll be able to find, at one time, people with 
> knowledge of more than 4 or 5 of the vc's (e.g. I know only git) who 
> have the time to address this issue.

I think we only have 4-5 backends which correspond to reasonably popular 
version control systems. The rest can simply follow their example.

> What we can do instead, though, is 
> to encourage people to properly write the backend specific functions.

How?

> The fact that I can't argue in general that an arbitrary vc 
> system needs default-directory set suggests to me that one should leave 
> it to the vc system to decide. For example, I could imagine a backend 
> that wants the current directory to be the root directory of the 
> repository, rather than the directory containing the file.

Such backend (I'm not aware of any, though) could still rebind 
default-directory inside its function.




This bug report was last modified 4 years and 344 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.