aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-07-20 03:48:27 +0000
committerStefan Monnier2007-07-20 03:48:27 +0000
commit3b27900d2a4f84f5a826a59b7b0e544ffca5f0e7 (patch)
tree2da775ec90803c4191220ac753824acc33980ba9
parenta272e668c92ad0a4e0d986f7536862c3abb52bc2 (diff)
downloademacs-3b27900d2a4f84f5a826a59b7b0e544ffca5f0e7.tar.gz
emacs-3b27900d2a4f84f5a826a59b7b0e544ffca5f0e7.zip
(vc-find-root): Fix case where `file' is the current
directory and the root as well.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/vc-hooks.el25
2 files changed, 19 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8f5460ef4d7..079e14914b3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-07-20 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * vc-hooks.el (vc-find-root): Fix case where `file' is the current
4 directory and the root as well.
5
12007-07-20 Dan Nicolaescu <dann@ics.uci.edu> 62007-07-20 Dan Nicolaescu <dann@ics.uci.edu>
2 7
3 * vc-hooks.el (vc-default-workfile-unchanged-p): Pass a list 8 * vc-hooks.el (vc-default-workfile-unchanged-p): Pass a list
@@ -5,8 +10,7 @@
5 10
6 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments. 11 * vc-hg.el (vc-hg-print-log): Deal with multiple file arguments.
7 (vc-hg-registered): Replace if with when. 12 (vc-hg-registered): Replace if with when.
8 (vc-hg-state): Deal with nonexistent files and handle removed 13 (vc-hg-state): Deal with nonexistent files and handle removed files.
9 files.
10 (vc-hg-dir-state, vc-hg-dired-state-info): New functions. 14 (vc-hg-dir-state, vc-hg-dired-state-info): New functions.
11 (vc-hg-checkout): Re-enable. 15 (vc-hg-checkout): Re-enable.
12 (vc-hg-create-repo): Fix typos. 16 (vc-hg-create-repo): Fix typos.
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 83f9903e664..cbbfd8e7e22 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -317,24 +317,25 @@ The function walks up the directory tree from FILE looking for WITNESS.
317If WITNESS if not found, return nil, otherwise return the root." 317If WITNESS if not found, return nil, otherwise return the root."
318 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for 318 ;; Represent /home/luser/foo as ~/foo so that we don't try to look for
319 ;; witnesses in /home or in /. 319 ;; witnesses in /home or in /.
320 (while (not (file-exists-p file)) 320 (while (not (file-directory-p file))
321 (setq file (file-name-directory (directory-file-name file)))) 321 (setq file (file-name-directory (directory-file-name file))))
322 (setq file (abbreviate-file-name file)) 322 (setq file (abbreviate-file-name file))
323 (let ((root nil) 323 (let ((root nil)
324 (user (nth 2 (file-attributes file)))) 324 (user (nth 2 (file-attributes file))))
325 (while (not (or root 325 (while (not (or root
326 (equal file (setq file (file-name-directory file))) 326 (null file)
327 (null file) 327 ;; As a heuristic, we stop looking up the hierarchy of
328 ;; As a heuristic, we stop looking up the hierarchy of 328 ;; directories as soon as we find a directory belonging
329 ;; directories as soon as we find a directory belonging 329 ;; to another user. This should save us from looking in
330 ;; to another user. This should save us from looking in 330 ;; things like /net and /afs. This assumes that all the
331 ;; things like /net and /afs. This assumes that all the 331 ;; files inside a project belong to the same user.
332 ;; files inside a project belong to the same user. 332 (not (equal user (nth 2 (file-attributes file))))
333 (not (equal user (nth 2 (file-attributes file)))) 333 (string-match vc-ignore-dir-regexp file)))
334 (string-match vc-ignore-dir-regexp file)))
335 (if (file-exists-p (expand-file-name witness file)) 334 (if (file-exists-p (expand-file-name witness file))
336 (setq root file) 335 (setq root file)
337 (setq file (directory-file-name file)))) 336 (if (equal file
337 (setq file (file-name-directory (directory-file-name file))))
338 (setq file nil))))
338 root)) 339 root))
339 340
340;; Access functions to file properties 341;; Access functions to file properties