[Top][All Lists]

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

Re: vc-find-root and nonexistent drives

From: Stefan Monnier
Subject: Re: vc-find-root and nonexistent drives
Date: Sat, 16 Feb 2008 09:29:36 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> 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.


reply via email to

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