aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2008-02-16 21:38:24 +0000
committerStefan Monnier2008-02-16 21:38:24 +0000
commit5f8ea2c89be1481384b7844cce92e24e15f4e60d (patch)
tree0130c61adc47baef86ceea3aeb8dea51ac6ee5a9
parentf510617394561ae3ca65062265f9c37888f7b176 (diff)
downloademacs-5f8ea2c89be1481384b7844cce92e24e15f4e60d.tar.gz
emacs-5f8ea2c89be1481384b7844cce92e24e15f4e60d.zip
(vc-find-root): Remove initial loop because it's not
careful enough. Detect the uid-change all within the main loop.
-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 a92d8d16c73..4abf44350e0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12008-02-16 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * vc-hooks.el (vc-find-root): Remove initial loop because it's not
4 careful enough. Detect the uid-change all within the main loop.
5
12008-02-14 Stefan Monnier <monnier@pastel.home> 62008-02-14 Stefan Monnier <monnier@pastel.home>
2 7
3 * textmodes/sgml-mode.el (sgml-mode): Fix comment syntax. 8 * 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.
316If WITNESS if not found, return nil, otherwise return the root." 316If WITNESS if not found, return nil, otherwise return the root."
317 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for 317 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
318 ;; witnesses in /home or in /. 318 ;; witnesses in /home or in /.
319 (while (not (file-directory-p file))
320 (setq file (file-name-directory (directory-file-name file))))
321 (setq file (abbreviate-file-name file)) 319 (setq file (abbreviate-file-name file))
322 (let ((root nil) 320 (let ((root nil)
323 (user (nth 2 (file-attributes file)))) 321 ;; `user' is not initialized outside the loop because
322 ;; `file' may not exist, so we may have to walk up part of the
323 ;; hierarchy before we find the "initial UID".
324 (user nil))
324 (while (not (or root 325 (while (not (or root
325 (null file) 326 (null file)
326 ;; As a heuristic, we stop looking up the hierarchy of 327 ;; 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."
328 ;; to another user. This should save us from looking in 329 ;; to another user. This should save us from looking in
329 ;; things like /net and /afs. This assumes that all the 330 ;; things like /net and /afs. This assumes that all the
330 ;; files inside a project belong to the same user. 331 ;; files inside a project belong to the same user.
331 (not (equal user (nth 2 (file-attributes file)))) 332 (let ((prev-user user))
333 (setq user (nth 2 (file-attributes file)))
334 (and prev-user (not (equal user prev-user))))
332 (string-match vc-ignore-dir-regexp file))) 335 (string-match vc-ignore-dir-regexp file)))
333 (if (file-exists-p (expand-file-name witness file)) 336 (if (file-exists-p (expand-file-name witness file))
334 (setq root file) 337 (setq root file)