]> git.eshelyaron.com Git - emacs.git/commitdiff
* files.el (copy-directory): Compute target for recursive
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 12 Jan 2010 21:59:05 +0000 (22:59 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 12 Jan 2010 21:59:05 +0000 (22:59 +0100)
directories with identical names.  (Bug#5343)

lisp/ChangeLog
lisp/files.el

index 33b498f34d6151e0b6f8a5a880ea1587eba96c2b..3c95811a8fc640cd799a7b83d5f03b8355a4fa6f 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-12  Michael Albinus  <michael.albinus@gmx.de>
+
+       * files.el (copy-directory): Compute target for recursive
+       directories with identical names.  (Bug#5343)
+
 2010-01-12  Glenn Morris  <rgm@gnu.org>
 
        * mail/emacsbug.el (report-emacs-bug-pretest-address): Set
index 22f5936a1f65a8f09abc0fd8b2e0fb410f9ab1e5..302f114befe51b25d621b86c8ff63174a094b7bb 100644 (file)
@@ -4714,20 +4714,17 @@ this happens by default."
       ;; Compute target name.
       (setq directory (directory-file-name (expand-file-name directory))
            newname   (directory-file-name (expand-file-name newname)))
-      (if (and (file-directory-p newname)
-              (not (string-equal (file-name-nondirectory directory)
-                                 (file-name-nondirectory newname))))
-         (setq newname
-               (expand-file-name (file-name-nondirectory directory) newname)))
       (if (not (file-directory-p newname)) (make-directory newname parents))
 
       ;; Copy recursively.
       (mapc
        (lambda (file)
-        (if (file-directory-p file)
-            (copy-directory file newname keep-time parents)
-          (copy-file file newname t keep-time)))
-       ;; We do not want to delete "." and "..".
+        (let ((target (expand-file-name
+                       (file-name-nondirectory file) newname)))
+          (if (file-directory-p file)
+              (copy-directory file target keep-time parents)
+            (copy-file file target t keep-time))))
+       ;; We do not want to copy "." and "..".
        (directory-files        directory 'full directory-files-no-dot-files-regexp))
 
       ;; Set directory attributes.