mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-22 13:25:00 +00:00
More paranoid mtime check
This commit is contained in:
parent
5e50307748
commit
a1cb6e4e7a
2 changed files with 5 additions and 4 deletions
|
@ -208,7 +208,7 @@ class GitRepo:
|
||||||
|
|
||||||
mtime = self.aider_ignore_file.stat().st_mtime
|
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
|
self.aider_ignore_ts = mtime
|
||||||
lines = self.aider_ignore_file.read_text().splitlines()
|
lines = self.aider_ignore_file.read_text().splitlines()
|
||||||
self.aider_ignore_spec = pathspec.PathSpec.from_lines(
|
self.aider_ignore_spec = pathspec.PathSpec.from_lines(
|
||||||
|
|
|
@ -181,7 +181,8 @@ class TestRepo(unittest.TestCase):
|
||||||
fname.touch()
|
fname.touch()
|
||||||
raw_repo.git.add(str(fname))
|
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
|
# better be there
|
||||||
fnames = git_repo.get_tracked_files()
|
fnames = git_repo.get_tracked_files()
|
||||||
|
@ -202,14 +203,14 @@ class TestRepo(unittest.TestCase):
|
||||||
self.assertIn(str(fname), fnames)
|
self.assertIn(str(fname), fnames)
|
||||||
self.assertIn(str(fname2), fnames)
|
self.assertIn(str(fname2), fnames)
|
||||||
|
|
||||||
Path(".aiderignore").write_text("new.txt\n")
|
aiderignore.write_text("new.txt\n")
|
||||||
|
|
||||||
# new.txt should be gone!
|
# new.txt should be gone!
|
||||||
fnames = git_repo.get_tracked_files()
|
fnames = git_repo.get_tracked_files()
|
||||||
self.assertNotIn(str(fname), fnames)
|
self.assertNotIn(str(fname), fnames)
|
||||||
self.assertIn(str(fname2), fnames)
|
self.assertIn(str(fname2), fnames)
|
||||||
|
|
||||||
Path(".aiderignore").write_text("new2.txt\n")
|
aiderignore.write_text("new2.txt\n")
|
||||||
|
|
||||||
# new2.txt should be gone!
|
# new2.txt should be gone!
|
||||||
fnames = git_repo.get_tracked_files()
|
fnames = git_repo.get_tracked_files()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue