Loading list_files/loaders/git.py +19 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ class GitLoader(loaders.Loader): self.rules = rules.Rule(project_root, '', pattern, with_path=False) self.tails = [self.rules, None] git_dir = environ['GIT_DIR'] home = environ['HOME'] home_config = environ.get('XDG_CONFIG_HOME', path.join(home, '.config')) git_dir = environ.get('GIT_DIR', path.join(project_root, GIT_REPO)) # ancestor .gitignore files while target_path: Loading Loading @@ -49,7 +49,24 @@ class GitLoader(loaders.Loader): @classmethod def is_project_root(cls, dirpath): return path.isdir(path.join(dirpath, GIT_REPO)) git_path = path.join(dirpath, GIT_REPO) if path.isdir(git_path): environ.setdefault('GIT_DIR', git_path) return True elif not path.isfile(git_path): return False # .git is a file: with open(git_path) as f: for line in f: var, val = line.split(':', 1) if var.strip() == 'gitdir': git_path = path.join(dirpath, val.strip()) environ.setdefault('GIT_DIR', git_path) return True # .git exists, but does not contain a 'gitdir: XXX' line; strange... return False def load_from_dir(self, dirpath): Loading Loading
list_files/loaders/git.py +19 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,9 @@ class GitLoader(loaders.Loader): self.rules = rules.Rule(project_root, '', pattern, with_path=False) self.tails = [self.rules, None] git_dir = environ['GIT_DIR'] home = environ['HOME'] home_config = environ.get('XDG_CONFIG_HOME', path.join(home, '.config')) git_dir = environ.get('GIT_DIR', path.join(project_root, GIT_REPO)) # ancestor .gitignore files while target_path: Loading Loading @@ -49,7 +49,24 @@ class GitLoader(loaders.Loader): @classmethod def is_project_root(cls, dirpath): return path.isdir(path.join(dirpath, GIT_REPO)) git_path = path.join(dirpath, GIT_REPO) if path.isdir(git_path): environ.setdefault('GIT_DIR', git_path) return True elif not path.isfile(git_path): return False # .git is a file: with open(git_path) as f: for line in f: var, val = line.split(':', 1) if var.strip() == 'gitdir': git_path = path.join(dirpath, val.strip()) environ.setdefault('GIT_DIR', git_path) return True # .git exists, but does not contain a 'gitdir: XXX' line; strange... return False def load_from_dir(self, dirpath): Loading