emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 047f02f: Fix new copy-directory bug with empty di


From: Paul Eggert
Subject: [Emacs-diffs] emacs-26 047f02f: Fix new copy-directory bug with empty dirs
Date: Wed, 20 Sep 2017 14:50:40 -0400 (EDT)

branch: emacs-26
commit 047f02f00f602b9aef63ae8938e12f3f0ab481eb
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix new copy-directory bug with empty dirs
    
    Problem reported by Afdam Plaice (Bug#28520) and by Eli Zaretskii
    (Bug#28483#34).  This is another bug that I introduced in my
    recent copy-directory changes.
    * lisp/files.el (copy-directory): Work with empty subdirectories, too.
    * test/lisp/files-tests.el (files-tests--copy-directory):
    Test for this bug.
---
 lisp/files.el            | 2 +-
 test/lisp/files-tests.el | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index 0c30d40..f0a1f23 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5564,7 +5564,7 @@ into NEWNAME instead."
              (filetype (car (file-attributes file))))
          (cond
           ((eq filetype t)       ; Directory but not a symlink.
-           (copy-directory file newname keep-time parents))
+           (copy-directory file target keep-time parents t))
           ((stringp filetype)    ; Symbolic link
            (make-symbolic-link filetype target t))
           ((copy-file file target t keep-time)))))
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index f2a9a32..285a884 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -399,11 +399,16 @@ name (Bug#28412)."
         (dirname (file-name-as-directory dir))
         (source (concat dirname "source"))
         (dest (concat dirname "dest/new/directory/"))
-        (file (concat (file-name-as-directory source) "file")))
+        (file (concat (file-name-as-directory source) "file"))
+        (source2 (concat dirname "source2"))
+        (dest2 (concat dirname "dest/new2")))
     (make-directory source)
     (write-region "" nil file)
     (copy-directory source dest t t t)
     (should (file-exists-p (concat dest "file")))
+    (make-directory (concat (file-name-as-directory source2) "a") t)
+    (copy-directory source2 dest2)
+    (should (file-directory-p (concat (file-name-as-directory dest2) "a")))
     (delete-directory dir 'recursive)))
 
 (provide 'files-tests)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]