More paranoid mtime check

This commit is contained in:
Paul Gauthier 2023-10-18 11:55:04 -07:00
parent 5e50307748
commit a1cb6e4e7a
2 changed files with 5 additions and 4 deletions

View file

@ -208,7 +208,7 @@ class GitRepo:
mtime = self.aider_ignore_file.stat().st_mtime
if mtime > self.aider_ignore_ts:
if mtime != self.aider_ignore_ts:
self.aider_ignore_ts = mtime
lines = self.aider_ignore_file.read_text().splitlines()
self.aider_ignore_spec = pathspec.PathSpec.from_lines(

View file

@ -181,7 +181,8 @@ class TestRepo(unittest.TestCase):
fname.touch()
raw_repo.git.add(str(fname))
git_repo = GitRepo(InputOutput(), None, None, ".aiderignore")
aiderignore = Path(".aiderignore")
git_repo = GitRepo(InputOutput(), None, None, str(aiderignore))
# better be there
fnames = git_repo.get_tracked_files()
@ -202,14 +203,14 @@ class TestRepo(unittest.TestCase):
self.assertIn(str(fname), fnames)
self.assertIn(str(fname2), fnames)
Path(".aiderignore").write_text("new.txt\n")
aiderignore.write_text("new.txt\n")
# new.txt should be gone!
fnames = git_repo.get_tracked_files()
self.assertNotIn(str(fname), fnames)
self.assertIn(str(fname2), fnames)
Path(".aiderignore").write_text("new2.txt\n")
aiderignore.write_text("new2.txt\n")
# new2.txt should be gone!
fnames = git_repo.get_tracked_files()