unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: ludo@gnu.org (Ludovic Courtès)
Cc: 13866@debbugs.gnu.org
Subject: bug#13866: [VC] ‘vc-git-root’ is too lax
Date: Mon, 04 Mar 2013 09:58:33 -0500	[thread overview]
Message-ID: <jwvk3pncj38.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87zjyjijd1.fsf@gnu.org> ("Ludovic Courtès"'s message of "Mon, 04 Mar 2013 10:50:50 +0100")

> 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





  parent reply	other threads:[~2013-03-04 14:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04  9:50 bug#13866: [VC] ‘vc-git-root’ is too lax Ludovic Courtès
2013-03-04 10:56 ` Andreas Schwab
2013-03-04 13:16   ` Ludovic Courtès
2013-03-04 14:58 ` Stefan Monnier [this message]
2013-03-04 15:11   ` Christopher Schmidt
2013-03-04 16:00   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvk3pncj38.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=13866@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).