Commit e50772e3 authored by Michael Albinus's avatar Michael Albinus
Browse files

* net/tramp-sh.el (tramp-sh-handle-vc-registered): Run first pass

only when `remote-file-name-inhibit-cache' is nil.
(tramp-sh-file-name-handler): Use `tramp-error'.  Simplify code.
parent f2c5082b
2014-03-07 Michael Albinus <michael.albinus@gmx.de>
* net/tramp-sh.el (tramp-sh-handle-vc-registered): Run first pass
only when `remote-file-name-inhibit-cache' is nil.
(tramp-sh-file-name-handler): Use `tramp-error'. Simplify code.
2014-03-06 Martin Rudalics <rudalics@gmx.at> 2014-03-06 Martin Rudalics <rudalics@gmx.at>
* window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins): * window.el (fit-frame-to-buffer, fit-frame-to-buffer-margins):
......
...@@ -3306,48 +3306,49 @@ the result will be a local, non-Tramp, filename." ...@@ -3306,48 +3306,49 @@ the result will be a local, non-Tramp, filename."
(with-tramp-progress-reporter (with-tramp-progress-reporter
v 3 (format "Checking `vc-registered' for %s" file) v 3 (format "Checking `vc-registered' for %s" file)
;; There could be new files, created by the vc backend. We (unless remote-file-name-inhibit-cache
;; cannot reuse the old cache entries, therefore. ;; There could be new files, created by the vc backend. We
(let (tramp-vc-registered-file-names ;; cannot reuse the old cache entries, therefore.
(remote-file-name-inhibit-cache (current-time)) (let (tramp-vc-registered-file-names
(file-name-handler-alist (remote-file-name-inhibit-cache (current-time))
`((,tramp-file-name-regexp . tramp-vc-file-name-handler)))) (file-name-handler-alist
`((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
;; Here we collect only file names, which need an operation.
(ignore-errors (tramp-run-real-handler 'vc-registered (list file))) ;; Here we collect only file names, which need an operation.
(tramp-message v 10 "\n%s" tramp-vc-registered-file-names) (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
(tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
;; Send just one command, in order to fill the cache.
(when tramp-vc-registered-file-names ;; Send just one command, in order to fill the cache.
(tramp-maybe-send-script (when tramp-vc-registered-file-names
v (tramp-maybe-send-script
(format tramp-vc-registered-read-file-names v
(tramp-get-file-exists-command v) (format tramp-vc-registered-read-file-names
(format "%s -r" (tramp-get-test-command v))) (tramp-get-file-exists-command v)
"tramp_vc_registered_read_file_names") (format "%s -r" (tramp-get-test-command v)))
"tramp_vc_registered_read_file_names")
(dolist
(elt (dolist
(ignore-errors (elt
;; We cannot use `tramp-send-command-and-read', (ignore-errors
;; because this does not cooperate well with ;; We cannot use `tramp-send-command-and-read',
;; heredoc documents. ;; because this does not cooperate well with
(tramp-send-command ;; heredoc documents.
v (tramp-send-command
(format v
"tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n" (format
tramp-end-of-heredoc "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
(mapconcat 'tramp-shell-quote-argument tramp-end-of-heredoc
tramp-vc-registered-file-names (mapconcat 'tramp-shell-quote-argument
"\n") tramp-vc-registered-file-names
tramp-end-of-heredoc)) "\n")
(with-current-buffer (tramp-get-connection-buffer v) tramp-end-of-heredoc))
;; Read the expression. (with-current-buffer (tramp-get-connection-buffer v)
(goto-char (point-min)) ;; Read the expression.
(read (current-buffer))))) (goto-char (point-min))
(read (current-buffer)))))
(tramp-set-file-property
v (car elt) (cadr elt) (cadr (cdr elt)))))) (tramp-set-file-property
v (car elt) (cadr elt) (cadr (cdr elt)))))))
;; Second run. Now all `file-exists-p' or `file-readable-p' ;; Second run. Now all `file-exists-p' or `file-readable-p'
;; calls shall be answered from the file cache. We unset ;; calls shall be answered from the file cache. We unset
...@@ -3363,17 +3364,18 @@ the result will be a local, non-Tramp, filename." ...@@ -3363,17 +3364,18 @@ the result will be a local, non-Tramp, filename."
Fall back to normal file name handler if no Tramp handler exists." Fall back to normal file name handler if no Tramp handler exists."
(when (and tramp-locked (not tramp-locker)) (when (and tramp-locked (not tramp-locker))
(setq tramp-locked nil) (setq tramp-locked nil)
(signal 'file-error (list "Forbidden reentrant call of Tramp"))) (tramp-error
(car-safe tramp-current-connection) 'file-error
"Forbidden reentrant call of Tramp"))
(let ((tl tramp-locked)) (let ((tl tramp-locked))
(setq tramp-locked t)
(unwind-protect (unwind-protect
(progn (let ((tramp-locker t))
(setq tramp-locked t) (save-match-data
(let ((tramp-locker t)) (let ((fn (assoc operation tramp-sh-file-name-handler-alist)))
(save-match-data (if fn
(let ((fn (assoc operation tramp-sh-file-name-handler-alist))) (apply (cdr fn) args)
(if fn (tramp-run-real-handler operation args)))))
(apply (cdr fn) args)
(tramp-run-real-handler operation args))))))
(setq tramp-locked tl)))) (setq tramp-locked tl))))
(defun tramp-vc-file-name-handler (operation &rest args) (defun tramp-vc-file-name-handler (operation &rest args)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment