Minor Tramp fixes

* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
Fix a bug when renaming.

* test/lisp/net/tramp-tests.el (tramp-test21-file-links): Extend test.
(tramp-test42-delay-load, tramp-test42-remote-load-path):
Skip unless Emacs >= 26.
This commit is contained in:
Michael Albinus 2017-12-08 16:37:53 +01:00
parent c0a670a8b5
commit 7eea3144d4
2 changed files with 22 additions and 7 deletions

View file

@ -683,7 +683,6 @@ file names."
(let ((t1 (tramp-tramp-file-p filename))
(t2 (tramp-tramp-file-p newname))
(equal-remote (tramp-equal-remote filename newname))
(file-operation (intern (format "%s-file" op)))
(gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move"))
(msg-operation (if (eq op 'copy) "Copying" "Renaming")))
@ -698,9 +697,11 @@ file names."
;; We cannot copy or rename directly.
(let ((tmpfile (tramp-compat-make-temp-file filename)))
(funcall
file-operation filename tmpfile t keep-date preserve-uid-gid
preserve-extended-attributes)
(if (eq op 'copy)
(copy-file
filename tmpfile t keep-date preserve-uid-gid
preserve-extended-attributes)
(rename-file filename tmpfile t))
(rename-file tmpfile newname ok-if-already-exists))
;; Direct action.

View file

@ -2810,7 +2810,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
;; Symbolic links could look like a remote file name.
;; They must be quoted then.
(delete-file tmp-name2)
(make-symbolic-link "/penguin:motd:" tmp-name2)
(make-symbolic-link
(funcall
(if quoted 'tramp-compat-file-name-unquote 'identity)
"/penguin:motd:")
tmp-name2)
(should (file-symlink-p tmp-name2))
(should
(string-equal
@ -4631,6 +4635,10 @@ process sentinels. They shall not disturb each other."
(ert-deftest tramp-test42-delay-load ()
"Check that Tramp is loaded lazily, only when needed."
;; The autoloaded Tramp objects are different since Emacs 26.1. We
;; cannot test older Emacsen, therefore.
(skip-unless (tramp--test-emacs26-p))
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t.
@ -4643,8 +4651,8 @@ process sentinels. They shall not disturb each other."
(message \"Tramp loaded: %%s\" (featurep 'tramp)) \
(file-name-all-completions \"/foo:\" \"/\") \
(message \"Tramp loaded: %%s\" (featurep 'tramp)))"))
;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1.
(dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil)))
;; Tramp doesn't load when `tramp-mode' is nil.
(dolist (tm '(t nil))
(should
(string-match
(format
@ -4682,6 +4690,10 @@ process sentinels. They shall not disturb each other."
(ert-deftest tramp-test42-remote-load-path ()
"Check that Tramp autoloads its packages with remote `load-path'."
;; The autoloaded Tramp objects are different since Emacs 26.1. We
;; cannot test older Emacsen, therefore.
(skip-unless (tramp--test-emacs26-p))
;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
;; It shall still work, when a remote file name is in the
;; `load-path'.
@ -4759,6 +4771,8 @@ Since it unloads Tramp, it shall be the last test to run."
;; * dired-compress-file
;; * dired-uncache
;; * file-equal-p (partly done in `tramp-test21-file-links')
;; * file-in-directory-p
;; * file-name-case-insensitive-p
;; * Work on skipped tests. Make a comment, when it is impossible.