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


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: 26066 <at> debbugs.gnu.org
Cc: Jonathan Ganc <jonganc <at> gmail.com>
Subject: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Wed, 15 Mar 2017 20:42:54 -0400
[Message part 1 (text/plain, inline)]
[Please use Reply All to keep 26066 <at> debbugs.gnu.org on Cc]

[Message part 2 (message/rfc822, inline)]
From: Jonathan Ganc <jonganc <at> gmail.com>
To: npostavs <at> users.sourceforge.net
Subject: Re: bug#26066: 26.0.50; vc-git-status gives wrong result
Date: Tue, 14 Mar 2017 20:25:57 -0400
The actual problem is with the function vc-git--empty-db-p, which acts 
in the directory default-directory (implicitly, through vc-git--call and 
then process-file). Thus, I think replacing (in vc-git-state)
(vc-git--empty-db-p)
with
(let ((default-directory (file-name-directory file)))
   (vc-git--empty-db-p))
should resolve the issue without side effect.

As an aside, is there a reason that vc-git-status does not use "git 
status -z --porcelain --ignored"? It seems more natural/straightfoward 
and it would also deal with ignored and removed files. It could also 
work with directories, which the current function doesn't.
[Message part 3 (text/plain, inline)]

Let-binding default-directory sounds okay.

Regarding 'status -z --porcelain', I think it might not have been
available at the time te code was written.  I'm not sure how far back we
need to maintain compatibility.

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.