branch: externals/tramp
commit 10d7de235368896ba3e1354f7869e92fb6b806fb
Author: Michael Albinus <[email protected]>
Commit: Michael Albinus <[email protected]>

    Tramp ELPA version 2.7.1.2 released
---
 README               |  6 ++--
 texi/trampver.texi   |  2 +-
 tramp-integration.el | 61 ++++++++++++++++++----------------
 tramp-sh.el          | 93 ++++++++++++++++++++++++++++------------------------
 tramp-smb.el         |  3 --
 trampver.el          |  6 ++--
 6 files changed, 89 insertions(+), 82 deletions(-)

diff --git a/README b/README
index a1d872777a..5f4eaf9c05 100644
--- a/README
+++ b/README
@@ -32,11 +32,11 @@ Emacs 28 or older
 
    • Remove all byte-compiled Tramp files
 
-          $ rm -f ~/.emacs.d/elpa/tramp-2.7.1.1/tramp*.elc
+          $ rm -f ~/.emacs.d/elpa/tramp-2.7.1.2/tramp*.elc
 
    • Start Emacs with Tramp's source files
 
-          $ emacs -L ~/.emacs.d/elpa/tramp-2.7.1.1 -l tramp
+          $ emacs -L ~/.emacs.d/elpa/tramp-2.7.1.2 -l tramp
 
      This should not give you the error.
 
@@ -50,7 +50,7 @@ Mitigation of a bug in Emacs 29.1
 ---------------------------------
 
 Due to a bug in Emacs 29.1, you must apply the following change prior
-installation or upgrading Tramp 2.7.1.1 from GNU ELPA:
+installation or upgrading Tramp 2.7.1.2 from GNU ELPA:
 
      (when (string-equal emacs-version "29.1")
        (with-current-buffer
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 21b3ef1bc3..9b37e196ea 100644
--- a/texi/trampver.texi
+++ b/texi/trampver.texi
@@ -7,7 +7,7 @@
 
 @c In the  Tramp GIT, the version number and the bug report address
 @c are auto-frobbed from configure.ac.
-@set trampver 2.7.1.1
+@set trampver 2.7.1.2
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 27.1
diff --git a/tramp-integration.el b/tramp-integration.el
index 56deaf9066..8d039c25ea 100644
--- a/tramp-integration.el
+++ b/tramp-integration.el
@@ -274,35 +274,38 @@ NAME must be equal to `tramp-current-connection'."
 
 ;;; Integration of shortdoc.el:
 
-(with-eval-after-load 'shortdoc
-  (dolist (elem `((file-remote-p
-                  :eval (file-remote-p "/ssh:user@host:/tmp/foo")
-                  :eval (file-remote-p "/ssh:user@host:/tmp/foo" 'method)
-                  :eval (file-remote-p "/ssh:user@[::1]#1234:/tmp/foo" 'host)
-                  ;; We don't want to see the text properties.
-                  :no-eval (file-remote-p "/sudo::/tmp/foo" 'user)
-                  :result ,(substring-no-properties
-                            (file-remote-p "/sudo::/tmp/foo" 'user)))
-                 (file-local-name
-                  :eval (file-local-name "/ssh:user@host:/tmp/foo"))
-                 (file-local-copy
-                  :no-eval (file-local-copy "/ssh:user@host:/tmp/foo")
-                  :eg-result "/tmp/tramp.8ihLbO"
-                  :eval (file-local-copy "/tmp/foo"))))
-    (unless (assoc (car elem)
-                  (member "Remote Files" (assq 'file shortdoc--groups)))
-      (shortdoc-add-function 'file "Remote Files" elem)))
-
-  (add-hook
-   'tramp-integration-unload-hook
-   (lambda ()
-     (let ((glist (assq 'file shortdoc--groups)))
-       (while (and (consp glist)
-                   (not (and (stringp (cadr glist))
-                             (string-equal (cadr glist) "Remote Files"))))
-         (setq glist (cdr glist)))
-       (when (consp glist)
-         (setcdr glist nil))))))
+(tramp--with-startup
+ (with-eval-after-load 'shortdoc
+   ;; Some packages deactivate Tramp.  They don't deserve a shortdoc entry 
then.
+   (when (file-remote-p "/ssh:user@host:/tmp/foo")
+     (dolist (elem `((file-remote-p
+                     :eval (file-remote-p "/ssh:user@host:/tmp/foo")
+                     :eval (file-remote-p "/ssh:user@host:/tmp/foo" 'method)
+                     :eval (file-remote-p "/ssh:user@[::1]#1234:/tmp/foo" 
'host)
+                     ;; We don't want to see the text properties.
+                     :no-eval (file-remote-p "/sudo::/tmp/foo" 'user)
+                     :result ,(substring-no-properties
+                               (file-remote-p "/sudo::/tmp/foo" 'user)))
+                    (file-local-name
+                     :eval (file-local-name "/ssh:user@host:/tmp/foo"))
+                    (file-local-copy
+                     :no-eval (file-local-copy "/ssh:user@host:/tmp/foo")
+                     :eg-result "/tmp/tramp.8ihLbO"
+                     :eval (file-local-copy "/tmp/foo"))))
+       (unless (assoc (car elem)
+                     (member "Remote Files" (assq 'file shortdoc--groups)))
+        (shortdoc-add-function 'file "Remote Files" elem)))
+
+     (add-hook
+      'tramp-integration-unload-hook
+      (lambda ()
+        (let ((glist (assq 'file shortdoc--groups)))
+         (while (and (consp glist)
+                      (not (and (stringp (cadr glist))
+                                (string-equal (cadr glist) "Remote Files"))))
+            (setq glist (cdr glist)))
+         (when (consp glist)
+            (setcdr glist nil))))))))
 
 ;;; Integration of compile.el:
 
diff --git a/tramp-sh.el b/tramp-sh.el
index 8fde854a97..190a6aa9e8 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -2023,49 +2023,56 @@ ID-FORMAT valid values are `string' and `integer'."
          (t2 (tramp-tramp-file-p newname))
          target)
       (with-parsed-tramp-file-name (if t1 dirname newname) nil
-       (unless (file-exists-p dirname)
-         (tramp-error v 'file-missing dirname))
-
-       ;; `copy-directory-create-symlink' exists since Emacs 28.1.
-       (if (and (bound-and-true-p copy-directory-create-symlink)
-                (setq target (file-symlink-p dirname))
-                (tramp-equal-remote dirname newname))
-           (make-symbolic-link
-            target
-            (if (directory-name-p newname)
-                (concat newname (file-name-nondirectory dirname)) newname)
-            t)
-
-         (if (and (not copy-contents)
-                  (tramp-get-method-parameter v 'tramp-copy-recursive)
-                  ;; When DIRNAME and NEWNAME are remote, they must
-                  ;; have the same method.
-                  (or (null t1) (null t2)
-                      (string-equal
-                       (tramp-file-name-method
-                        (tramp-dissect-file-name dirname))
-                       (tramp-file-name-method
-                        (tramp-dissect-file-name newname)))))
-             ;; scp or rsync DTRT.
-             (progn
-               (when (and (file-directory-p newname)
-                          (not (directory-name-p newname)))
-                 (tramp-error v 'file-already-exists newname))
-               (setq dirname (directory-file-name (expand-file-name dirname))
-                     newname (directory-file-name (expand-file-name newname)))
-               (when (and (file-directory-p newname)
-                          (not (string-equal (file-name-nondirectory dirname)
-                                             (file-name-nondirectory 
newname))))
-                 (setq newname
-                       (expand-file-name
-                        (file-name-nondirectory dirname) newname)))
-               (unless (file-directory-p (file-name-directory newname))
-                 (make-directory (file-name-directory newname) parents))
-               (tramp-do-copy-or-rename-file-out-of-band
-                'copy dirname newname 'ok-if-already-exists keep-date))
-
-           ;; We must do it file-wise.
-           (tramp-run-real-handler
+       (cond
+        ;; `copy-directory-create-symlink' exists since Emacs 28.1.
+        ((and (bound-and-true-p copy-directory-create-symlink)
+              (setq target (file-symlink-p dirname))
+              (tramp-equal-remote dirname newname))
+         (make-symbolic-link
+          target
+          (if (directory-name-p newname)
+              (concat newname (file-name-nondirectory dirname)) newname)
+          t))
+
+        ;; Shortcut: if method, host, user are the same for both
+        ;; files, we invoke `cp' on the remote host directly.
+        ((and (not copy-contents)
+              (tramp-equal-remote dirname newname))
+         (when (and (file-directory-p newname)
+                    (not (directory-name-p newname)))
+           (tramp-error v 'file-already-exists newname))
+         (setq dirname (directory-file-name (expand-file-name dirname))
+               newname (directory-file-name (expand-file-name newname)))
+         (tramp-do-copy-or-rename-file-directly
+          'copy dirname newname
+          'ok-if-already-exists keep-date 'preserve-uid-gid))
+
+        ;; scp or rsync DTRT.
+        ((and (not copy-contents)
+              (tramp-get-method-parameter v 'tramp-copy-recursive)
+              ;; When DIRNAME and NEWNAME are remote, they must have
+              ;; the same method.
+              (or (null t1) (null t2)
+                  (string-equal
+                   (tramp-file-name-method (tramp-dissect-file-name dirname))
+                   (tramp-file-name-method (tramp-dissect-file-name 
newname)))))
+         (when (and (file-directory-p newname)
+                    (not (directory-name-p newname)))
+           (tramp-error v 'file-already-exists newname))
+         (setq dirname (directory-file-name (expand-file-name dirname))
+               newname (directory-file-name (expand-file-name newname)))
+         (when (and (file-directory-p newname)
+                    (not (string-equal (file-name-nondirectory dirname)
+                                       (file-name-nondirectory newname))))
+           (setq newname
+                 (expand-file-name (file-name-nondirectory dirname) newname)))
+         (unless (file-directory-p (file-name-directory newname))
+           (make-directory (file-name-directory newname) parents))
+         (tramp-do-copy-or-rename-file-out-of-band
+          'copy dirname newname 'ok-if-already-exists keep-date))
+
+        ;; We must do it file-wise.
+        (t (tramp-run-real-handler
             #'copy-directory
             (list dirname newname keep-date parents copy-contents))))
 
diff --git a/tramp-smb.el b/tramp-smb.el
index c6c3caabdc..930708ae6e 100644
--- a/tramp-smb.el
+++ b/tramp-smb.el
@@ -428,9 +428,6 @@ arguments to pass to the OPERATION."
          (t2 (tramp-tramp-file-p newname))
          target)
       (with-parsed-tramp-file-name (if t1 dirname newname) nil
-       (unless (file-exists-p dirname)
-         (tramp-error v 'file-missing dirname))
-
        ;; `copy-directory-create-symlink' exists since Emacs 28.1.
        (if (and (bound-and-true-p copy-directory-create-symlink)
                 (setq target (file-symlink-p dirname))
diff --git a/trampver.el b/trampver.el
index 9501079383..c43386a190 100644
--- a/trampver.el
+++ b/trampver.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <[email protected]>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.7.1.1
+;; Version: 2.7.1.2
 ;; Package-Requires: ((emacs "27.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
@@ -40,7 +40,7 @@
 ;; ./configure" to change them.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.7.1.1"
+(defconst tramp-version "2.7.1.2"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -76,7 +76,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-version-lessp emacs-version "27.1"))
       "ok"
-    (format "Tramp 2.7.1.1 is not fit for %s"
+    (format "Tramp 2.7.1.2 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 

Reply via email to