changeset 104615:6915f976dcd2

(vc-dir-node-directory, vc-dir-update): Get the parent directory correctly in case the item is a directory itself.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 26 Aug 2009 06:45:36 +0000
parents 92965f3f01f0
children 2d38fd635554
files lisp/ChangeLog lisp/vc-dir.el
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Aug 26 05:26:22 2009 +0000
+++ b/lisp/ChangeLog	Wed Aug 26 06:45:36 2009 +0000
@@ -1,5 +1,8 @@
 2009-08-26  Dan Nicolaescu  <dann@ics.uci.edu>
 
+	* vc-dir.el (vc-dir-node-directory, vc-dir-update): Get the parent
+	directory correctly in case the item is a directory itself.
+
 	* vc.el: Document the desired behavior for reverted files in the
 	`added' state.
 
--- a/lisp/vc-dir.el	Wed Aug 26 05:26:22 2009 +0000
+++ b/lisp/vc-dir.el	Wed Aug 26 06:45:36 2009 +0000
@@ -326,8 +326,9 @@
     (or (vc-dir-fileinfo->directory data)
 	;; Otherwise compute it from the file name.
 	(file-name-directory
-	 (expand-file-name
-	  (vc-dir-fileinfo->name data))))))
+	 (directory-file-name
+	  (expand-file-name
+	   (vc-dir-fileinfo->name data)))))))
 
 (defun vc-dir-update (entries buffer &optional noinsert)
   "Update BUFFER's ewoc from the list of ENTRIES.
@@ -343,8 +344,10 @@
 	  ;; names too many times
 	  (sort entries
 		(lambda (entry1 entry2)
-		  (let ((dir1 (file-name-directory (expand-file-name (car entry1))))
-			(dir2 (file-name-directory (expand-file-name (car entry2)))))
+		  (let ((dir1 (file-name-directory
+			        (directory-file-name (expand-file-name (car entry1)))))
+			(dir2 (file-name-directory
+			       (directory-file-name (expand-file-name (car entry2))))))
 		    (cond
 		     ((string< dir1 dir2) t)
 		     ((not (string= dir1 dir2)) nil)
@@ -362,8 +365,10 @@
 
       (while (and entry node)
 	(let* ((entryfile (car entry))
-	       (entrydir (file-name-directory (expand-file-name entryfile)))
+	       (entrydir (file-name-directory (directory-file-name
+					       (expand-file-name entryfile))))
 	       (nodedir (vc-dir-node-directory node)))
+	  (message "entryfile %s entrydir %s" entryfile entrydir)
 	  (cond
 	   ;; First try to find the directory.
 	   ((string-lessp nodedir entrydir)
@@ -406,7 +411,8 @@
       (unless (or node noinsert)
 	(let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1))))
 	  (dolist (entry entries)
-	    (let ((entrydir (file-name-directory (expand-file-name (car entry)))))
+	    (let ((entrydir (file-name-directory
+			     (directory-file-name (expand-file-name (car entry))))))
 	      ;; Insert a directory node if needed.
 	      (unless (string-equal lastdir entrydir)
 		(setq lastdir entrydir)