Ignore only what the repo generates, in place of the allowlist

This commit is contained in:
2026-12-04 04:05:58 +01:00
parent 138a091f73
commit 0b8d5ac396
4 changed files with 23 additions and 261 deletions
+17 -24
View File
@@ -7,33 +7,22 @@ sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from repo_checks import ROOT
PRIVATE = [
".claude/settings.local.json",
".credentials.json",
"auto-mode-transcripts/a.jsonl",
"backups/.claude.json.backup.1",
"daemon-auth-status.json",
"daemon.log",
"daemon/control.key",
"debug/a.txt",
"file-history/a/b.md",
"history.jsonl",
"jobs/a/b.json",
"memory/MEMORY.md",
"paste-cache/a.txt",
"projects/-home-a/a.jsonl",
"projects/-home-a/memory/MEMORY.md",
"projects/-home-a/memory/a.md",
"session-env/a/b.sh",
"sessions/a.json",
"shell-snapshots/a.sh",
"tasks/a/b.json",
GENERATED = [
"bin/__pycache__/a.cpython-313.pyc",
"bin/agent_cycle/__pycache__/a.cpython-313.pyc",
"workflow-bench/a-1-1.md",
"workflow-bench/a-1-1/README.md",
"workflow-bench/compare/a/A1/fixes.diff",
"workflow-bench/logs/a.jsonl",
]
AUTHORED = [
"bin/agent_cycle/run.py",
"workflow-bench/advisor-judge-prompt.md",
"workflow-bench/bench.py",
"workflow-bench/setup.cfg",
]
class Gitignore(unittest.TestCase):
def test_ignores_no_tracked_file(self):
@@ -44,6 +33,10 @@ class Gitignore(unittest.TestCase):
ignored = subprocess.run(["git", "ls-files", "-oi", "--exclude-standard", "--", "bin/*.py", "bin/**/*.py"], capture_output=True, check=True, cwd=ROOT, text=True).stdout
self.assertEqual(ignored, "")
def test_ignores_every_private_file(self):
ignored = subprocess.run(["git", "check-ignore", "--no-index", "--stdin"], capture_output=True, cwd=ROOT, input="\n".join(PRIVATE), text=True).stdout
self.assertEqual(ignored.splitlines(), PRIVATE)
def test_ignores_every_generated_file(self):
ignored = subprocess.run(["git", "check-ignore", "--no-index", "--stdin"], capture_output=True, cwd=ROOT, input="\n".join(GENERATED), text=True).stdout
self.assertEqual(ignored.splitlines(), GENERATED)
def test_ignores_no_authored_file(self):
ignored = subprocess.run(["git", "check-ignore", "--no-index", "--stdin"], capture_output=True, cwd=ROOT, input="\n".join(AUTHORED), text=True).stdout
self.assertEqual(ignored, "")