[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13866: [VC] ‘vc-git-root’ is too lax
From: |
Stefan Monnier |
Subject: |
bug#13866: [VC] ‘vc-git-root’ is too lax |
Date: |
Mon, 04 Mar 2013 09:58:33 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> 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