refactor: Move find_common_root into aider/utils.py and update Coder class to use it

This commit is contained in:
Paul Gauthier (aider) 2024-08-22 13:55:32 -07:00
parent 8c886d7dd3
commit 221cde0fed
2 changed files with 11 additions and 7 deletions

View file

@ -434,13 +434,7 @@ class Coder:
bold = False
def find_common_root(self):
if len(self.abs_fnames) == 1:
self.root = os.path.dirname(list(self.abs_fnames)[0])
elif self.abs_fnames:
self.root = os.path.commonpath(list(self.abs_fnames))
else:
self.root = os.getcwd()
self.root = utils.find_common_root(self.abs_fnames)
self.root = utils.safe_abs_path(self.root)
def add_rel_fname(self, rel_fname):