Files
claude-config/bin/test_gitignore.py
T

43 lines
1.2 KiB
Python

import subprocess
import unittest
from test_python_floor 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",
"loop-claude-transcripts/a/b.jsonl",
"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",
"workflow-bench/a-1-1.md",
"workflow-bench/a-1-1/README.md",
"workflow-bench/judge/a/A1/fixes.diff",
"workflow-bench/logs/a.jsonl",
]
class Gitignore(unittest.TestCase):
def test_ignores_no_tracked_file(self):
ignored = subprocess.run(["git", "ls-files", "-ci", "--exclude-standard"], 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)