diff --git a/git-status-all b/git-status-all index feed037..7fc322c 100755 --- a/git-status-all +++ b/git-status-all @@ -12,9 +12,11 @@ import re import subprocess import click +import psutil # TODO config file (and defaults here) +IGNORE_FS_TYPES = ['tmpfs', 'proc', 'sysfs', 'devpts', 'nfs', 'fuse.rclone'] IGNORES = [ r"\.sync", r"\.git/modules", # XXX check this again @@ -23,8 +25,24 @@ IGNORES = [ ] +mount_fs_map = {p.mountpoint: p.fstype for p in psutil.disk_partitions(all=True)} + + +def get_fs_type(path): + path = os.path.realpath(path) + while path != '/': + if path in mount_fs_map: + return mount_fs_map[path] + path = os.path.dirname(path) + return mount_fs_map.get('/', 'unknown') + + def git_directories(startdir) -> Path: for dirpath, dirnames, _ in os.walk(startdir): + fs_type = get_fs_type(dirpath) + if fs_type in IGNORE_FS_TYPES: + dirnames.clear() + continue if any(re.search(ignore, dirpath) for ignore in IGNORES): continue if set(["info", "objects", "refs"]).issubset(set(dirnames)):