mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 00:35:00 +00:00
Added a new parameter aider_ignore_file
to the __init__
method of GitRepo
class and added a new method filter_ignored_files
to filter files based on gitignore type specs.
This commit is contained in:
parent
6f453e2ac1
commit
10f2e114c5
1 changed files with 9 additions and 1 deletions
|
@ -12,7 +12,7 @@ from .dump import dump # noqa: F401
|
||||||
class GitRepo:
|
class GitRepo:
|
||||||
repo = None
|
repo = None
|
||||||
|
|
||||||
def __init__(self, io, fnames, git_dname):
|
def __init__(self, io, fnames, git_dname, aider_ignore_file=None):
|
||||||
self.io = io
|
self.io = io
|
||||||
|
|
||||||
if git_dname:
|
if git_dname:
|
||||||
|
@ -49,6 +49,8 @@ class GitRepo:
|
||||||
self.repo = git.Repo(repo_paths.pop(), odbt=git.GitDB)
|
self.repo = git.Repo(repo_paths.pop(), odbt=git.GitDB)
|
||||||
self.root = utils.safe_abs_path(self.repo.working_tree_dir)
|
self.root = utils.safe_abs_path(self.repo.working_tree_dir)
|
||||||
|
|
||||||
|
self.aider_ignore_file = aider_ignore_file
|
||||||
|
|
||||||
def commit(self, fnames=None, context=None, prefix=None, message=None):
|
def commit(self, fnames=None, context=None, prefix=None, message=None):
|
||||||
if not fnames and not self.repo.is_dirty():
|
if not fnames and not self.repo.is_dirty():
|
||||||
return
|
return
|
||||||
|
@ -195,6 +197,12 @@ class GitRepo:
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def filter_ignored_files(self, fnames):
|
||||||
|
if not self.aider_ignore_file:
|
||||||
|
return
|
||||||
|
|
||||||
|
# todo: use pathspec to filter fnames according to the gitignore type specs in self.aider_ignore_file
|
||||||
|
|
||||||
def path_in_repo(self, path):
|
def path_in_repo(self, path):
|
||||||
if not self.repo:
|
if not self.repo:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue