bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Dmitry Gutov
Subject: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Mon, 1 May 2017 04:57:33 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Thunderbird/53.0

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.





reply via email to

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