unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Juanma Barranquero" <lekktu@gmail.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: vc-find-root and nonexistent drives
Date: Sat, 16 Feb 2008 09:29:36 -0500	[thread overview]
Message-ID: <jwvhcg9kmdz.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <f7ccd24b0802151952i3745b417nd1fb1d738a045fe6@mail.gmail.com> (Juanma Barranquero's message of "Sat, 16 Feb 2008 04:52:35 +0100")

> The reason is that currently, `vc-find-root' does:

>   (while (not (file-directory-p file))
>     (setq file (file-name-directory (directory-file-name file))))

> which assumes that the output of `file-name-directory' will be
> different in each iteration of the while loop.

I don't follow.  The code in the 22 branch does:

    (while (not (or root
                    (null file)
                    ;; As a heuristic, we stop looking up the hierarchy of
                    ;; directories as soon as we find a directory belonging
                    ;; to another user.  This should save us from looking in
                    ;; things like /net and /afs.  This assumes that all the
                    ;; files inside a project belong to the same user.
                    (not (equal user (nth 2 (file-attributes file))))
                    (string-match vc-ignore-dir-regexp file)))
      (if (file-exists-p (expand-file-name witness file))
          (setq root file)
        (if (equal file
                   (setq file (file-name-directory (directory-file-name file))))
            (setq file nil))))

where you see (last 3 lines) that it checks that `file' does change at
each iteration.

> That is not so when the
> drive does not exist, for example:
>   (file-name-directory (directory-file-name "g:/")) => "g:/"

So the `equal' test should trigger and force exiting the loop.
I.e. there much be something else at play here.


        Stefan




  parent reply	other threads:[~2008-02-16 14:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-16  3:52 vc-find-root and nonexistent drives Juanma Barranquero
2008-02-16 13:43 ` Eli Zaretskii
2008-02-16 18:12   ` Juanma Barranquero
2008-02-16 20:16     ` Stefan Monnier
2008-02-16 20:18       ` Juanma Barranquero
2008-02-16 14:29 ` Stefan Monnier [this message]
2008-02-16 18:09   ` Juanma Barranquero
2008-02-16 20:33     ` Stefan Monnier
2008-02-16 20:46       ` Juanma Barranquero
2008-02-17  4:18       ` Eli Zaretskii
2008-02-17 19:00         ` Stefan Monnier

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=jwvhcg9kmdz.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /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).