mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 06:15:00 +00:00
Add set_repo() function to set self.repo to the single repository that all the files belong to.
This commit is contained in:
parent
cc50c380f8
commit
5afeb29c94
1 changed files with 13 additions and 0 deletions
13
coder.py
13
coder.py
|
@ -68,8 +68,21 @@ class Coder:
|
|||
|
||||
self.fnames[str(fname)] = fname.stat().st_mtime
|
||||
|
||||
self.set_repo()
|
||||
self.check_for_local_edits(True)
|
||||
|
||||
def set_repo(self):
|
||||
repo_paths = set(
|
||||
git.Repo(fname, search_parent_directories=True).git_dir
|
||||
for fname in self.fnames
|
||||
)
|
||||
|
||||
if len(repo_paths) > 1:
|
||||
repo_paths = " ".join(repo_paths)
|
||||
raise ValueError(f"Files must all be in one git repo, not: {repo_paths}")
|
||||
|
||||
self.repo = git.Repo(repo_paths.pop())
|
||||
|
||||
self.pretty = pretty
|
||||
|
||||
def quoted_file(self, fname):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue