mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
fix: Improve handling of ignored files in GitRepo class
This commit is contained in:
parent
f458fa86ac
commit
17e2c02a47
1 changed files with 3 additions and 1 deletions
|
@ -259,6 +259,7 @@ class GitRepo:
|
||||||
return str(Path(PurePosixPath((Path(self.root) / path).relative_to(self.root))))
|
return str(Path(PurePosixPath((Path(self.root) / path).relative_to(self.root))))
|
||||||
|
|
||||||
def ignored_file(self, fname):
|
def ignored_file(self, fname):
|
||||||
|
orig_fname = fname
|
||||||
if fname in self.ignore_file_cache:
|
if fname in self.ignore_file_cache:
|
||||||
return self.ignore_file_cache[fname]
|
return self.ignore_file_cache[fname]
|
||||||
|
|
||||||
|
@ -266,6 +267,7 @@ class GitRepo:
|
||||||
try:
|
try:
|
||||||
fname_path = Path(self.normalize_path(fname)).resolve()
|
fname_path = Path(self.normalize_path(fname)).resolve()
|
||||||
cwd_path = Path.cwd().resolve()
|
cwd_path = Path.cwd().resolve()
|
||||||
|
|
||||||
if not fname_path.is_relative_to(cwd_path):
|
if not fname_path.is_relative_to(cwd_path):
|
||||||
return True
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -290,7 +292,7 @@ class GitRepo:
|
||||||
)
|
)
|
||||||
|
|
||||||
result = self.aider_ignore_spec.match_file(fname)
|
result = self.aider_ignore_spec.match_file(fname)
|
||||||
self.ignore_file_cache[fname] = result
|
self.ignore_file_cache[orig_fname] = result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def path_in_repo(self, path):
|
def path_in_repo(self, path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue