changeset 92163:12326ccb66d6

(vc-cvs-register): Fix registering of directories in multiple file case.
author Glenn Morris <rgm@gnu.org>
date Sun, 24 Feb 2008 22:54:08 +0000
parents 9c14521521cf
children 9ec23fe6e33c
files lisp/vc-cvs.el
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc-cvs.el	Sun Feb 24 22:51:00 2008 +0000
+++ b/lisp/vc-cvs.el	Sun Feb 24 22:54:08 2008 +0000
@@ -298,15 +298,18 @@
 
 `vc-register-switches' and `vc-cvs-register-switches' are passed to
 the CVS command (in that order)."
-  (when (and (not (vc-cvs-responsible-p file))
-	       (vc-cvs-could-register file))
-      ;; Register the directory if needed.
-      (vc-cvs-register (directory-file-name (file-name-directory file))))
-    (apply 'vc-cvs-command nil 0 files
-	   "add"
-	   (and comment (string-match "[^\t\n ]" comment)
-		(concat "-m" comment))
-	   (vc-switches 'CVS 'register)))
+  ;; Register the directories if needed.
+  (let (dirs)
+    (dolist (file files)
+      (and (not (vc-cvs-responsible-p file))
+           (vc-cvs-could-register file)
+           (push (directory-file-name (file-name-directory file)) dirs)))
+    (if dirs (vc-cvs-register dirs)))
+  (apply 'vc-cvs-command nil 0 files
+         "add"
+         (and comment (string-match "[^\t\n ]" comment)
+              (concat "-m" comment))
+         (vc-switches 'CVS 'register)))
 
 (defun vc-cvs-responsible-p (file)
   "Return non-nil if CVS thinks it is responsible for FILE."