Commit b8e54362 authored by Dan Nicolaescu's avatar Dan Nicolaescu
Browse files

(vc-dir-node-directory, vc-dir-update): Get the parent

directory correctly in case the item is a directory itself.
parent 239b3340
2009-08-26 Dan Nicolaescu <dann@ics.uci.edu> 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 * vc.el: Document the desired behavior for reverted files in the
`added' state. `added' state.
......
...@@ -326,8 +326,9 @@ If BODY uses EVENT, it should be a variable, ...@@ -326,8 +326,9 @@ If BODY uses EVENT, it should be a variable,
(or (vc-dir-fileinfo->directory data) (or (vc-dir-fileinfo->directory data)
;; Otherwise compute it from the file name. ;; Otherwise compute it from the file name.
(file-name-directory (file-name-directory
(expand-file-name (directory-file-name
(vc-dir-fileinfo->name data)))))) (expand-file-name
(vc-dir-fileinfo->name data)))))))
(defun vc-dir-update (entries buffer &optional noinsert) (defun vc-dir-update (entries buffer &optional noinsert)
"Update BUFFER's ewoc from the list of ENTRIES. "Update BUFFER's ewoc from the list of ENTRIES.
...@@ -343,8 +344,10 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." ...@@ -343,8 +344,10 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
;; names too many times ;; names too many times
(sort entries (sort entries
(lambda (entry1 entry2) (lambda (entry1 entry2)
(let ((dir1 (file-name-directory (expand-file-name (car entry1)))) (let ((dir1 (file-name-directory
(dir2 (file-name-directory (expand-file-name (car entry2))))) (directory-file-name (expand-file-name (car entry1)))))
(dir2 (file-name-directory
(directory-file-name (expand-file-name (car entry2))))))
(cond (cond
((string< dir1 dir2) t) ((string< dir1 dir2) t)
((not (string= dir1 dir2)) nil) ((not (string= dir1 dir2)) nil)
...@@ -362,8 +365,10 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." ...@@ -362,8 +365,10 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
(while (and entry node) (while (and entry node)
(let* ((entryfile (car entry)) (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))) (nodedir (vc-dir-node-directory node)))
(message "entryfile %s entrydir %s" entryfile entrydir)
(cond (cond
;; First try to find the directory. ;; First try to find the directory.
((string-lessp nodedir entrydir) ((string-lessp nodedir entrydir)
...@@ -406,7 +411,8 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc." ...@@ -406,7 +411,8 @@ If NOINSERT, ignore elements on ENTRIES which are not in the ewoc."
(unless (or node noinsert) (unless (or node noinsert)
(let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1)))) (let ((lastdir (vc-dir-node-directory (ewoc-nth vc-ewoc -1))))
(dolist (entry entries) (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. ;; Insert a directory node if needed.
(unless (string-equal lastdir entrydir) (unless (string-equal lastdir entrydir)
(setq lastdir entrydir) (setq lastdir entrydir)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment