From 1704ecd3748e142abe005cc18d9979e3bbbae818 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 27 Nov 2024 20:42:36 +0100 Subject: [PATCH] Unbreak tramp-sh.el --- lisp/net/tramp-sh.el | 49 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 8b51ee2dbf5..e8fd251457c 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3735,31 +3735,30 @@ Fall back to normal file name handler if no Tramp handler exists." (defun tramp-vc-file-name-handler (operation &rest args) "Invoke special file name handler, which collects files to be handled." (save-match-data - (let ((filename - (tramp-replace-environment-variables - (apply #'tramp-file-name-for-operation operation args))) - (fn (assoc operation tramp-sh-file-name-handler-alist))) - (if (tramp-tramp-file-p filename) - (with-parsed-tramp-file-name filename nil - (cond - ;; That's what we want: file names, for which checks are - ;; applied. We assume that VC uses only `file-exists-p' - ;; `file-readable-p' and `file-directory-p' checks; - ;; otherwise we must extend the list. We do not perform - ;; any action, but return nil, in order to keep - ;; `vc-registered' running. - ((and fn (memq operation - '(file-exists-p file-readable-p file-directory-p))) - (add-to-list 'tramp-vc-registered-file-names localname 'append) - nil) - ;; `process-file' and `start-file-process' shall be ignored. - ((and fn (eq operation 'process-file) 0)) - ((and fn (eq operation 'start-file-process) nil)) - ;; Tramp file name handlers like `expand-file-name'. They - ;; must still work. - (fn (save-match-data (apply (cdr fn) args))) - ;; Default file name handlers, we don't care. - (t (tramp-run-real-handler operation args)))) + (if-let* ((filename + (tramp-replace-environment-variables + (apply #'tramp-file-name-for-operation operation args))) + ((tramp-tramp-file-p filename)) + (fn (assoc operation tramp-sh-file-name-handler-alist))) + (with-parsed-tramp-file-name filename nil + (cond + ;; That's what we want: file names, for which checks are + ;; applied. We assume that VC uses only `file-exists-p', + ;; `file-readable-p' and `file-directory-p' checks; + ;; otherwise we must extend the list. The respective cache + ;; value must be set for these functions in + ;; `tramp-bundle-read-file-names'. + ;; We do not perform any action, but return nil, in order + ;; to keep `vc-registered' running. + ((memq operation '(file-exists-p file-readable-p file-directory-p)) + (add-to-list 'tramp-vc-registered-file-names localname 'append) + nil) + ;; `process-file' and `start-file-process' shall be ignored. + ((eq operation 'process-file) 0) + ((eq operation 'start-file-process) nil) + ;; Tramp file name handlers like `expand-file-name'. They + ;; must still work. + (t (save-match-data (apply (cdr fn) args))))) ;; When `tramp-mode' is not enabled, or the file name is not a ;; remote file name, we don't do anything. Same for default -- 2.39.5