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 #91 received at 26066 <at> debbugs.gnu.org (full text, mbox):

From: Jonathan Ganc <jonganc <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>, 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: Thu, 13 Apr 2017 20:42:42 -0400
[Message part 1 (text/plain, inline)]
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 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!).

I continue to think that binding default-directory in vc-git-state makes 
the most sense.

> 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? 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.

> Is it necessary for correct output in other backends, in similar 
> scenarios?
>
> I agree that fixing this makes sense, but it should be done in an 
> organized fashion

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. 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. What we can do instead, though, is 
to encourage people to properly write the backend specific functions. 
If, at some point, we notice that every vc-BACKEND-state binds 
default-directory, then we can move the binding to vc-state.

However, this question reinforces my opinion that binding 
default-directory can be treated satisfactorily as a backend-specific 
question. 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.
[0001-update-vc-git.patch (text/x-patch, attachment)]

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

Previous Next


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