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

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

bug#13866: [VC] ‘vc-git-root’ is too lax


From: Ludovic Courtès
Subject: bug#13866: [VC] ‘vc-git-root’ is too lax
Date: Mon, 04 Mar 2013 17:00:14 +0100
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux)

Stefan Monnier <monnier@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’.





reply via email to

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