the same value of the VERBOSE argument (interactively, the prefix
argument).
-If one or more directories are in the fileset, start `vc-dir' in the root
-directory of the repository that includes the current directory, with
-the same files/directories marked in the VC-Directory buffer that were
-marked in the original Dired buffer. If the current directory doesn't
-belong to a VCS repository, prompt for a repository directory. In this
-case, the VERBOSE argument is ignored."
+If one or more directories are in the fileset, start `vc-dir' in the
+root directory of the repository that includes the current directory,
+with all directories in the fileset marked in the VC-Directory buffer
+that were marked in the original Dired buffer. If the current directory
+doesn't belong to a VCS repository, prompt for a repository directory.
+In this case, the VERBOSE argument is ignored."
(interactive "P" dired-mode)
(let* ((marked-files
(dired-get-marked-files nil nil nil nil t))
(defun vc-dir-mark-files (mark-files)
"Mark files specified by file names in the argument MARK-FILES.
-MARK-FILES should be a list of absolute filenames."
+MARK-FILES should be a list of absolute filenames.
+Directories must have trailing slashes."
+ ;; Filter out subitems that would be implicitly marked.
+ (setq mark-files (sort mark-files))
+ (let ((next mark-files))
+ (while next
+ (when (string-suffix-p "/" (car next))
+ (while (string-prefix-p (car next) (cadr next))
+ (rplacd next (cddr next))))
+ (setq next (cdr next))))
+
(ewoc-map
(lambda (filearg)
(when (member (expand-file-name (vc-dir-fileinfo->name filearg))