]> git.eshelyaron.com Git - emacs.git/commitdiff
Unbreak tramp-sh.el
authorEshel Yaron <me@eshelyaron.com>
Wed, 27 Nov 2024 19:42:36 +0000 (20:42 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 27 Nov 2024 19:42:36 +0000 (20:42 +0100)
lisp/net/tramp-sh.el

index 8b51ee2dbf5e145f08fc2d3a37a267da48ab750d..e8fd251457c49ee34c9d500d960529ae9b829bd0 100644 (file)
@@ -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