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


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 13866 <at> debbugs.gnu.org
Subject: Re: bug#13866: [VC] ‘vc-git-root’ is
	too lax
Date: Mon, 04 Mar 2013 09:58:33 -0500
> 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").


        Stefan




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

Previous Next


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