summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-02-16 21:38:24 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-02-16 21:38:24 +0000
commitc36c8ebfac7c5403ddd037a40889f423e1d268d1 (patch)
tree6d6e7bb2135d33c0ef1492d29f8f48ac49c45efa /lisp
parentc3e2a0bfc88b5edc650546a872f993a6868a3377 (diff)
downloademacs-c36c8ebfac7c5403ddd037a40889f423e1d268d1.tar.gz
(vc-find-root): Remove initial loop because it's not
careful enough. Detect the uid-change all within the main loop.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc-hooks.el11
2 files changed, 12 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6648979827d..4d01b8cadd6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-02-16 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * vc-hooks.el (vc-find-root): Remove initial loop because it's not
+ careful enough. Detect the uid-change all within the main loop.
+
2008-02-14 Stefan Monnier <monnier@pastel.home>
* textmodes/sgml-mode.el (sgml-mode): Fix comment syntax.
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 64a7d8f527a..0bf03b2789b 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -316,11 +316,12 @@ The function walks up the directory tree from FILE looking for WITNESS.
If WITNESS if not found, return nil, otherwise return the root."
;; Represent /home/luser/foo as ~/foo so that we don't try to look for
;; witnesses in /home or in /.
- (while (not (file-directory-p file))
- (setq file (file-name-directory (directory-file-name file))))
(setq file (abbreviate-file-name file))
(let ((root nil)
- (user (nth 2 (file-attributes file))))
+ ;; `user' is not initialized outside the loop because
+ ;; `file' may not exist, so we may have to walk up part of the
+ ;; hierarchy before we find the "initial UID".
+ (user nil))
(while (not (or root
(null file)
;; As a heuristic, we stop looking up the hierarchy of
@@ -328,7 +329,9 @@ If WITNESS if not found, return nil, otherwise return the root."
;; 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))))
+ (let ((prev-user user))
+ (setq user (nth 2 (file-attributes file)))
+ (and prev-user (not (equal user prev-user))))
(string-match vc-ignore-dir-regexp file)))
(if (file-exists-p (expand-file-name witness file))
(setq root file)