Loading list_files/loaders/git.py +9 −7 Original line number Diff line number Diff line from os import path, environ from configparser import ConfigParser, NoOptionError from configparser import ConfigParser, NoOptionError, NoSectionError from .. import loaders, patterns, rules, walk, util Loading @@ -21,9 +21,10 @@ class GitLoader(loaders.Loader): home_config = environ.get('XDG_CONFIG_HOME', path.join(home, '.config')) # ancestor .gitignore files while target_path: target_path = path.dirname(target_path) self.load_from_dir(target_path) target_path_split = list(path.split(target_path)) while target_path_split: self.load_from_dir(path.join(*target_path_split)) del target_path_split[-1] # $GIT_DIR/info/exclude files excludes_file = path.join(git_dir, 'info/exclude') Loading @@ -41,7 +42,7 @@ class GitLoader(loaders.Loader): config.read(config_files) try: excludes_file = config.get('core', 'excludesfile') except NoOptionError: except (NoOptionError, NoSectionError): excludes_file = path.join(home_config, 'git/ignore') with util.ignore_if_missing(): self.load_patterns('', excludes_file) Loading Loading @@ -86,10 +87,11 @@ class GitLoader(loaders.Loader): def load_patterns(self, directory, filename): rule_list = [] with open(path.join(self.project_root, directory, filename)) as f: fullpath = path.join(self.project_root, directory, filename) with open(fullpath) as f: for line in f: rule_opts = dict(with_path=True) pattern_opts = dict() pattern_opts = dict(double_asterix=True) line = line.strip() if line.endswith('\\'): Loading Loading
list_files/loaders/git.py +9 −7 Original line number Diff line number Diff line from os import path, environ from configparser import ConfigParser, NoOptionError from configparser import ConfigParser, NoOptionError, NoSectionError from .. import loaders, patterns, rules, walk, util Loading @@ -21,9 +21,10 @@ class GitLoader(loaders.Loader): home_config = environ.get('XDG_CONFIG_HOME', path.join(home, '.config')) # ancestor .gitignore files while target_path: target_path = path.dirname(target_path) self.load_from_dir(target_path) target_path_split = list(path.split(target_path)) while target_path_split: self.load_from_dir(path.join(*target_path_split)) del target_path_split[-1] # $GIT_DIR/info/exclude files excludes_file = path.join(git_dir, 'info/exclude') Loading @@ -41,7 +42,7 @@ class GitLoader(loaders.Loader): config.read(config_files) try: excludes_file = config.get('core', 'excludesfile') except NoOptionError: except (NoOptionError, NoSectionError): excludes_file = path.join(home_config, 'git/ignore') with util.ignore_if_missing(): self.load_patterns('', excludes_file) Loading Loading @@ -86,10 +87,11 @@ class GitLoader(loaders.Loader): def load_patterns(self, directory, filename): rule_list = [] with open(path.join(self.project_root, directory, filename)) as f: fullpath = path.join(self.project_root, directory, filename) with open(fullpath) as f: for line in f: rule_opts = dict(with_path=True) pattern_opts = dict() pattern_opts = dict(double_asterix=True) line = line.strip() if line.endswith('\\'): Loading