I don't think Magit will be responsible for that; but vc
might?
See whether vc-ignore-dir-regexp
helps. That has a default value of:
"\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'"
For ease of editing and reading, let's use rx
syntax. The excellent xr
package on GNU ELPA gives me the following rx
syntax for the default vc-ignore-dir-regexp
value:
(seq bos (or (seq (any "/\\") (any "/\\")
(one-or-more (not (any "/\\")))
(any "/\\"))
(seq "/" (or "net" "afs" "...") "/"))
eos)))
So let's try the following. I'm using tramp-methods
to establish the remote path syntax possibilities.
n.b. The position of the (eval-when-compile (require 'tramp))
looks very odd, but our usage of the rx
macro needs tramp-methods
to be defined at byte-compile time, and this achieves that without unnecessarily loading tramp in other circumstances. We could alternatively use the rx-to-string
function instead of the rx
macro, but this way we retain the slight compile-time performance benefit.
(with-eval-after-load "tramp"
(eval-when-compile (require 'tramp))
(setq vc-ignore-dir-regexp
(rx (seq bos
(or (seq (any "/\\") (any "/\\")
(one-or-more (not (any "/\\")))
(any "/\\"))
(seq "/" (or "net" "afs" "...") "/")
;; Ignore all tramp paths.
(seq "/"
(eval (cons 'or (mapcar #'car tramp-methods)))
":"
(zero-or-more anything)))
eos))))