From 173a91a8c2606746fe80d7cba99ffcbd3e8b75d3 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Thu, 11 May 2023 16:54:10 -0700 Subject: [PATCH] Fixed a bug in Coder class where the common root directory was not being set correctly. --- aider/coder.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aider/coder.py b/aider/coder.py index 4cc287e85..9e0e08493 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -59,10 +59,12 @@ class Coder: self.show_diffs = show_diffs def find_common_root(self): - if not self.abs_fnames: + if self.abs_fnames: + common_prefix = os.path.commonpath(list(self.abs_fnames)) + self.root = os.path.dirname(common_prefix) + else: self.root = os.getcwd() - common_prefix = os.path.commonpath(list(self.abs_fnames)) - self.root = os.path.dirname(common_prefix) + self.console.print(f"[bright_black]Common root directory: {self.root}") def set_repo(self, cmd_line_fnames):