Fix issue with path normalization that was causing files to be marked dirty on Windows when they were not

This commit is contained in:
Christopher Toth 2023-12-29 13:04:46 -05:00
parent 00d5348ee6
commit ba87510db1

View file

@ -195,12 +195,15 @@ class GitRepo:
# convert to appropriate os.sep, since git always normalizes to / # convert to appropriate os.sep, since git always normalizes to /
res = set( res = set(
str(Path(PurePosixPath((Path(self.root) / path).relative_to(self.root)))) self.normalize_path(path)
for path in files for path in files
) )
return self.filter_ignored_files(res) return self.filter_ignored_files(res)
def normalize_path(self, path):
return str(Path(PurePosixPath((Path(self.root) / path).relative_to(self.root))))
def filter_ignored_files(self, fnames): def filter_ignored_files(self, fnames):
if not self.aider_ignore_file or not self.aider_ignore_file.is_file(): if not self.aider_ignore_file or not self.aider_ignore_file.is_file():
return fnames return fnames
@ -221,7 +224,7 @@ class GitRepo:
return return
tracked_files = set(self.get_tracked_files()) tracked_files = set(self.get_tracked_files())
return path in tracked_files return self.normalize_path(path) in tracked_files
def abs_root_path(self, path): def abs_root_path(self, path):
res = Path(self.root) / path res = Path(self.root) / path