From 6a018a2d7e4fd53e5c2340e8ba159667e4244cec Mon Sep 17 00:00:00 2001 From: Toru TSUNEYOSHI Date: Sat, 16 Aug 2025 12:56:09 +0200 Subject: [PATCH] Improve use of "touch" in Tramp * lisp/net/tramp-sh.el (tramp-get-remote-touch): Set connection property "touch-h". (tramp-sh-handle-set-file-times): Use it. --- lisp/net/tramp-sh.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 287b46fc72e..80ae71dfc64 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -1601,7 +1601,10 @@ of." "-t %s" (format-time-string "%Y%m%d%H%M.%S" (tramp-defined-time time) t)) "") - (if (eq flag 'nofollow) "-h" "") + (if (and (eq flag 'nofollow) + (tramp-get-connection-property v "touch-h")) + "-h" + "") (tramp-shell-quote-argument localname)))))) (defun tramp-sh-handle-get-home-directory (vec &optional user) @@ -5892,6 +5895,14 @@ Nonexistent directories are removed from spec." result (format-time-string "%Y%m%d%H%M.%S") (tramp-file-local-name tmpfile)))) + (tramp-set-connection-property + vec "touch-h" + (tramp-send-command-and-check + vec + (format + "%s -h %s" + result + (tramp-file-local-name tmpfile)))) (delete-file tmpfile)) result)))