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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13866 in the body.
You can then email your comments to 13866 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13866; Package emacs. (Mon, 04 Mar 2013 09:52:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Mar 2013 09:52:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-emacs <at> gnu.org
Subject: [VC] ‘vc-git-root’ is too lax
Date: Mon, 04 Mar 2013 10:50:50 +0100
[Message part 1 (text/plain, inline)]
Hello,

‘vc-git-root’ as found in Emacs 24.2.1 is too lax: when called from a
non-Git directory under $HOME, it ends up returning ~/ because users
normally have a ~/.git directory holding a config file.

A better definition would be something like this:

[Message part 2 (application/emacs-lisp, inline)]
[Message part 3 (text/plain, inline)]
Thanks,
Ludo’.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13866; Package emacs. (Mon, 04 Mar 2013 10:58:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
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 11:56:51 +0100
ludo <at> gnu.org (Ludovic Courtès) writes:

> ‘vc-git-root’ as found in Emacs 24.2.1 is too lax: when called from a
> non-Git directory under $HOME, it ends up returning ~/ because users
> normally have a ~/.git directory holding a config file.

Do they?  Who created it?

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Mon, 04 Mar 2013 13:18:02 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Mon, 04 Mar 2013 13:18:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 13866-done <at> debbugs.gnu.org
Subject: Re: bug#13866: [VC] ‘vc-git-root’ is
	too lax
Date: Mon, 04 Mar 2013 14:16:55 +0100
Andreas Schwab <schwab <at> linux-m68k.org> skribis:

> ludo <at> gnu.org (Ludovic Courtès) writes:
>
>> ‘vc-git-root’ as found in Emacs 24.2.1 is too lax: when called from a
>> non-Git directory under $HOME, it ends up returning ~/ because users
>> normally have a ~/.git directory holding a config file.
>
> Do they?  Who created it?

I did, but now I realize that ~/.gitconfig is what matters nowadays (or
maybe ~/.git/config never mattered, even.)

Sorry for the noise.

Ludo’.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13866; Package emacs. (Mon, 04 Mar 2013 14:59:01 GMT) Full text and rfc822 format available.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13866; Package emacs. (Mon, 04 Mar 2013 15:12:01 GMT) Full text and rfc822 format available.

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

From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#13866: [VC] ‘vc-git-root’ is
	too lax
Date: Mon,  4 Mar 2013 15:11:00 +0000 (GMT)
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> And of course you could have used simply (vc-find-root file
> ".git/objects").

That is not right.  .git in a git root directory might be a regular
file.

        Christopher




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13866; Package emacs. (Mon, 04 Mar 2013 16:01:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13866 <at> debbugs.gnu.org
Subject: Re: 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Apr 2013 11:24:03 GMT) Full text and rfc822 format available.

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.