Revert "repro/exp run: use git status when reminding to git-track files (#5544)" (#5596)

This reverts commit ce2d7c65db.
This commit is contained in:
Peter Rowlands (변기호)
2021-03-12 11:50:13 +09:00
committed by GitHub
parent d245008987
commit 686898240c
2 changed files with 5 additions and 24 deletions
+2 -11
View File
@@ -272,19 +272,10 @@ class Git(Base):
self.files_to_track = set()
def remind_to_track(self):
def _filter(files):
if not files:
return set()
staged, unstaged, untracked = self.status()
return files.intersection(
staged.get("modify", []) + unstaged + untracked
)
files_to_track = _filter(self.files_to_track)
if self.quiet or not files_to_track:
if self.quiet or not self.files_to_track:
return
files = " ".join(shlex.quote(path) for path in sorted(files_to_track))
files = " ".join(shlex.quote(path) for path in self.files_to_track)
logger.info(
"\n"
+3 -13
View File
@@ -528,20 +528,10 @@ def test_reset(tmp_dir, scm, git):
assert len(unstaged) == 2
def test_remind_to_track(tmp_dir, scm, caplog):
files = ["fname with spaces.txt", "тест", "foo"]
tmp_dir.gen({name: "foo" for name in files})
scm.files_to_track.update(files)
def test_remind_to_track(scm, caplog):
scm.files_to_track = ["fname with spaces.txt", "тест", "foo"]
scm.remind_to_track()
assert "git add 'fname with spaces.txt' foo 'тест'" in caplog.text
scm.add(["foo"])
caplog.clear()
scm.remind_to_track()
assert "git add 'fname with spaces.txt' 'тест'" in caplog.text
assert "foo" not in caplog.text
assert "git add 'fname with spaces.txt' 'тест' foo" in caplog.text
def test_add(tmp_dir, scm, git):