[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 1cd334c: Handle PARENTS properly in tramp-*-handl
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] emacs-26 1cd334c: Handle PARENTS properly in tramp-*-handle-make-directory |
Date: |
Sun, 8 Oct 2017 07:55:32 -0400 (EDT) |
branch: emacs-26
commit 1cd334cd47dd3d5085a0779499aff2f6617cb3d5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Handle PARENTS properly in tramp-*-handle-make-directory
* lisp/net/tramp-adb.el (tramp-adb-handle-make-directory):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-make-directory):
Handle PARENTS properly.
* test/lisp/net/tramp-tests.el (tramp-test13-make-directory):
Extend test.
---
lisp/net/tramp-adb.el | 9 +++++----
lisp/net/tramp-gvfs.el | 5 +++--
test/lisp/net/tramp-tests.el | 5 ++++-
3 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 5268e80..e75efcf 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -549,11 +549,12 @@ Emacs dired can't find files."
(let ((par (expand-file-name ".." dir)))
(unless (file-directory-p par)
(make-directory par parents))))
- (tramp-adb-barf-unless-okay
- v (format "mkdir %s" (tramp-shell-quote-argument localname))
- "Couldn't make directory %s" dir)
(tramp-flush-file-property v (file-name-directory localname))
- (tramp-flush-directory-property v localname)))
+ (tramp-flush-directory-property v localname)
+ (unless (or (tramp-adb-send-command-and-check
+ v (format "mkdir %s" (tramp-shell-quote-argument localname)))
+ (and parents (file-directory-p dir)))
+ (tramp-error v 'file-error "Couldn't make directory %s" dir))))
(defun tramp-adb-handle-delete-directory (directory &optional recursive _trash)
"Like `delete-directory' for Tramp files."
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 3a1c9f9..2b29a1b 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1206,8 +1206,9 @@ file-notify events."
(when (and parents (not (file-directory-p ldir)))
(make-directory ldir parents))
;; Just do it.
- (unless (tramp-gvfs-send-command
- v "gvfs-mkdir" (tramp-gvfs-url-file-name dir))
+ (unless (or (tramp-gvfs-send-command
+ v "gvfs-mkdir" (tramp-gvfs-url-file-name dir))
+ (and parents (file-directory-p dir)))
(tramp-error v 'file-error "Couldn't make directory %s" dir))))))
(defun tramp-gvfs-handle-rename-file
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a8fe06d..14102e7 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2105,7 +2105,10 @@ This tests also `file-directory-p' and
`file-accessible-directory-p'."
(should-error (make-directory tmp-name2) :type 'file-error)
(make-directory tmp-name2 'parents)
(should (file-directory-p tmp-name2))
- (should (file-accessible-directory-p tmp-name2)))
+ (should (file-accessible-directory-p tmp-name2))
+ ;; If PARENTS is non-nil, `make-directory' shall not
+ ;; signal an error when DIR exists already.
+ (make-directory tmp-name2 'parents))
;; Cleanup.
(ignore-errors (delete-directory tmp-name1 'recursive))))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] emacs-26 1cd334c: Handle PARENTS properly in tramp-*-handle-make-directory,
Michael Albinus <=