Skip to content

Commit 001a8c8

Browse files
committed
fix(ignore): add uv/pdm/bun/deno/flake locks to default ignores
Every other lock file (package-lock, yarn, pnpm, poetry, Cargo, ...) was already default-ignored, but uv.lock and other modern lockfiles leaked into output — only spared from bloat when they happened to exceed max-file-bytes. Claude-Session: https://claude.ai/code/session_0186xqSd1qXF2FbRfprfuAjN
1 parent 7f0aaaa commit 001a8c8

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

src/diffctx/ignore.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,11 +269,17 @@ def _collect_parent_ignore_patterns(root: Path, ignore_filenames: list[str]) ->
269269
"**/package-lock.json",
270270
"**/yarn.lock",
271271
"**/pnpm-lock.yaml",
272+
"**/bun.lock",
273+
"**/bun.lockb",
274+
"**/deno.lock",
272275
"**/Pipfile.lock",
273276
"**/poetry.lock",
277+
"**/uv.lock",
278+
"**/pdm.lock",
274279
"**/Cargo.lock",
275280
"**/composer.lock",
276281
"**/Gemfile.lock",
282+
"**/flake.lock",
277283
# Java/JVM
278284
"**/target/",
279285
"**/.gradle/",

tests/test_default_ignores.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,41 @@ def test_default_private_key_ignores(temp_project, run_mapper):
107107
assert f in all_files, f
108108

109109

110+
def test_default_lockfile_ignores(temp_project, run_mapper):
111+
lockfiles = [
112+
"package-lock.json",
113+
"yarn.lock",
114+
"pnpm-lock.yaml",
115+
"bun.lock",
116+
"bun.lockb",
117+
"deno.lock",
118+
"Pipfile.lock",
119+
"poetry.lock",
120+
"uv.lock",
121+
"pdm.lock",
122+
"Cargo.lock",
123+
"composer.lock",
124+
"Gemfile.lock",
125+
"flake.lock",
126+
]
127+
for lockfile in lockfiles:
128+
(temp_project / lockfile).write_text("generated lock content\n", encoding="utf-8")
129+
130+
kept = ["pyproject.toml", "package.json", "Cargo.toml"]
131+
for f in kept:
132+
(temp_project / f).write_text("real manifest\n", encoding="utf-8")
133+
134+
assert run_mapper([".", "-o", "directory_tree.yaml"])
135+
result = load_yaml(temp_project / "directory_tree.yaml")
136+
all_files = get_all_files_in_tree(result)
137+
138+
for lockfile in lockfiles:
139+
assert lockfile not in all_files, lockfile
140+
141+
for f in kept:
142+
assert f in all_files, f
143+
144+
110145
def test_default_directory_ignores(temp_project, run_mapper):
111146
for dir_name in ["node_modules", "venv", ".venv"]:
112147
d = temp_project / dir_name

0 commit comments

Comments
 (0)