mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
more robust get_tracked_files with pathlib
This commit is contained in:
parent
c6696e7245
commit
e996c56a51
2 changed files with 3 additions and 5 deletions
|
@ -955,10 +955,8 @@ class Coder:
|
||||||
def get_tracked_files(self):
|
def get_tracked_files(self):
|
||||||
# convert to appropriate os.sep, since git always normalizes to /
|
# convert to appropriate os.sep, since git always normalizes to /
|
||||||
files = set(self.repo.git.ls_files().splitlines())
|
files = set(self.repo.git.ls_files().splitlines())
|
||||||
# return files
|
res = set(str(Path(PurePosixPath(path))) for path in files)
|
||||||
if os.sep == "/":
|
return res
|
||||||
return files
|
|
||||||
return set(path.replace("/", os.sep) for path in files)
|
|
||||||
|
|
||||||
apply_update_errors = 0
|
apply_update_errors = 0
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class TestMain(TestCase):
|
||||||
# This will throw a git error on windows if get_tracked_files doesn't
|
# This will throw a git error on windows if get_tracked_files doesn't
|
||||||
# properly convert git/posix/paths to git\posix\paths.
|
# properly convert git/posix/paths to git\posix\paths.
|
||||||
# Because aider will try and `git add` a file that's already in the repo.
|
# Because aider will try and `git add` a file that's already in the repo.
|
||||||
main(["--yes", "--verbose", str(fname)], input=DummyInput(), output=DummyOutput())
|
main(["--yes", str(fname)], input=DummyInput(), output=DummyOutput())
|
||||||
|
|
||||||
def test_main_args(self):
|
def test_main_args(self):
|
||||||
with patch("aider.main.Coder.create") as MockCoder:
|
with patch("aider.main.Coder.create") as MockCoder:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue