GNU bug report logs - #13866
[VC] ‘vc-git-root’ is too lax

Previous Next

Package: emacs;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Mon, 4 Mar 2013 09:52:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: ludo <at> gnu.org (Ludovic Courtès)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13866 <at> debbugs.gnu.org
Subject: bug#13866: [VC] ‘vc-git-root’ is too lax
Date: Mon, 04 Mar 2013 17:00:14 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> skribis:

>> A better definition would be something like this:
>> (defun vc-git-root (file)
>>   (lexical-let ((root (vc-find-root file ".git")))
>>     (and (file-in-directory-p root "objects")
>>          root)))
>
> Beside the fact that ~/.git is not the config directory, the above code
> has some problems:
>
> vc-git.el uses lexical-binding, so using lexical-let in it is a bad idea.
> file-in-directory-p sounds completely wrong here.  You want to use
> (file-directory-p (expand-file-name "objects" root)) instead.
>
> And of course you could have used simply (vc-find-root file ".git/objects").

Indeed, point taken!

Ludo’.




This bug report was last modified 12 years and 142 days ago.

Previous Next


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