Commit 9a03f0e
release: v0.5.13 — auto-ignore git subtree imports, fix stale cache after ignore-config change
Two compounding problems made vendored upstream code (effect, etc.) flood the
flow groups in repos that use `git subtree add` to vendor dependencies.
On the otel-outbox-tracing-sentry worktree this surfaced as 3,500 files
from `repos/effect/` swamping the 400 files of real changes.
1. No subtree awareness. Diffcore had no way to know that `repos/effect/`
was vendored code rather than first-party source. Users had to manually
add `repos/effect/**` to `[ignore].paths` in `.diffcore.toml`, and most
never did because the source of the noise wasn't obvious.
2. Stale analysis cache. Even when users added the ignore pattern, the
on-disk analysis cache at `.diffcore/cache/<sha>.json` didn't include
ignore patterns in its key — so the cached result from before the
config change kept getting served. `--no-cache` looked like a workaround
but only skipped the IR cache; the analysis-cache check at main.rs:496
didn't honor the flag at all.
Fix:
- crates/diffcore-core/src/git.rs: new `detect_subtree_paths(repo)` walks
HEAD and matches three `git subtree` message shapes — `Squashed
'<path>/' content from commit`, `Add '<path>/' from commit '<sha>'`, and
`Merge commit '<sha>' as '<path>'`. Returns deduplicated, sorted paths,
filtered to those that still exist in the working directory (so a later
rename/delete doesn't ghost-add ignore entries).
- crates/diffcore-core/src/config.rs: new `IgnoreConfig.auto_subtrees`
field defaulting to true. New `DiffcoreConfig::apply_detected_subtrees`
method appends `<path>/**` globs to `ignore.paths`, skipping duplicates,
and returns the detected paths so callers can log them.
- crates/diffcore-core/src/cache.rs: `compute_cache_key` now takes the
ignore-pattern list as a second argument and folds a sorted hash of the
patterns into the SHA-256 key. Any ignore-config change — including
auto-detected subtrees — now invalidates the cache automatically.
- crates/diffcore-cli/src/main.rs: calls `apply_detected_subtrees` after
loading config in both analyze entry points, logs `Auto-ignoring N git
subtree path(s): …` at info level, passes ignore patterns into
`compute_cache_key`, and finally honors `args.no_cache` for the analysis
cache (previously it only affected the IR cache).
- crates/diffcore-tauri/src/commands.rs: same wiring inside the Tauri
analyze command so the desktop app gets the same behavior.
Tests:
- git.rs: 6 new tests — three for the message-parser covering each subtree
marker shape, one for unrelated messages, plus `detect_subtree_paths`
against a real temp repo that exercises the on-disk filter and the
dedupe/sort guarantees.
- config.rs: 4 new tests covering the `auto_subtrees` default, opt-out via
TOML, the no-op-when-disabled path, and full append behavior against a
real repo with a Squashed-style commit.
- cache.rs: 2 new tests — `cache_key_includes_ignore_patterns` proves the
key changes when patterns are added; `cache_key_ignore_pattern_order_independent`
proves pattern order doesn't break cache hits.
Verified locally on the otel-outbox-tracing-sentry worktree: file count
of `repos/effect/...` entries in flow groups drops from 1,502 to 0, total
groups drop from 660 to 164.
Opt out with:
[ignore]
auto_subtrees = false
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 368a847 commit 9a03f0e
8 files changed
Lines changed: 402 additions & 26 deletions
File tree
- crates
- diffcore-cli/src
- diffcore-core/src
- diffcore-tauri
- src
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
328 | | - | |
| 328 | + | |
329 | 329 | | |
| 330 | + | |
330 | 331 | | |
331 | 332 | | |
332 | 333 | | |
| |||
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
357 | | - | |
| 358 | + | |
358 | 359 | | |
359 | 360 | | |
360 | 361 | | |
| |||
442 | 443 | | |
443 | 444 | | |
444 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
445 | 456 | | |
446 | 457 | | |
447 | 458 | | |
| |||
480 | 491 | | |
481 | 492 | | |
482 | 493 | | |
483 | | - | |
484 | | - | |
485 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
486 | 499 | | |
487 | 500 | | |
488 | 501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| |||
250 | 262 | | |
251 | 263 | | |
252 | 264 | | |
253 | | - | |
254 | | - | |
| 265 | + | |
| 266 | + | |
255 | 267 | | |
256 | 268 | | |
257 | 269 | | |
258 | 270 | | |
259 | 271 | | |
260 | 272 | | |
261 | 273 | | |
262 | | - | |
| 274 | + | |
263 | 275 | | |
264 | 276 | | |
265 | 277 | | |
266 | 278 | | |
267 | 279 | | |
268 | 280 | | |
269 | | - | |
| 281 | + | |
270 | 282 | | |
271 | 283 | | |
272 | 284 | | |
273 | 285 | | |
274 | 286 | | |
275 | 287 | | |
276 | | - | |
| 288 | + | |
277 | 289 | | |
278 | 290 | | |
279 | 291 | | |
280 | 292 | | |
281 | 293 | | |
282 | | - | |
| 294 | + | |
283 | 295 | | |
284 | 296 | | |
285 | 297 | | |
286 | 298 | | |
287 | 299 | | |
288 | 300 | | |
289 | 301 | | |
290 | | - | |
| 302 | + | |
291 | 303 | | |
292 | 304 | | |
293 | 305 | | |
| |||
349 | 361 | | |
350 | 362 | | |
351 | 363 | | |
352 | | - | |
| 364 | + | |
353 | 365 | | |
354 | 366 | | |
355 | 367 | | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
356 | 390 | | |
357 | 391 | | |
358 | 392 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
96 | 117 | | |
97 | 118 | | |
98 | 119 | | |
| |||
378 | 399 | | |
379 | 400 | | |
380 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
381 | 424 | | |
382 | 425 | | |
383 | 426 | | |
| |||
920 | 963 | | |
921 | 964 | | |
922 | 965 | | |
| 966 | + | |
923 | 967 | | |
924 | 968 | | |
925 | 969 | | |
| |||
1320 | 1364 | | |
1321 | 1365 | | |
1322 | 1366 | | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
1323 | 1477 | | |
0 commit comments