fdu 0.2.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fdu-0.2.0 → fdu-0.3.0}/Cargo.lock +3 -3
- {fdu-0.2.0 → fdu-0.3.0}/Cargo.toml +2 -2
- {fdu-0.2.0 → fdu-0.3.0}/PKG-INFO +8 -2
- {fdu-0.2.0/crates/fdu-py → fdu-0.3.0}/README.md +7 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/Cargo.toml +1 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/README.md +5 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/build.rs +6 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/cli.rs +220 -32
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/skills/SKILL.md +24 -11
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/cli_exit.rs +71 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/watch_persistence.rs +126 -61
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/Cargo.toml +3 -2
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/README.md +1 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/build.rs +6 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/admission.rs +7 -2
- fdu-0.3.0/crates/fdu-core/src/classify/file_type_detection.rs +354 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_analysis.rs +461 -36
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_cache.rs +7 -1
- fdu-0.3.0/crates/fdu-core/src/content/content_code_metrics.rs +2279 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_model.rs +21 -6
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content.rs +12 -1
- fdu-0.3.0/crates/fdu-core/src/control/gitignore.rs +2562 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/control.rs +506 -9
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/counters.rs +50 -7
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/engine_contract.rs +27 -0
- fdu-0.3.0/crates/fdu-core/src/execution.rs +4225 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/index.rs +1457 -119
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/lib.rs +15 -4
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened.rs +69 -20
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_report.rs +375 -72
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_selection.rs +96 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/report_format/report_epilogue.rs +49 -8
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/report_format.rs +119 -19
- fdu-0.3.0/crates/fdu-core/src/scan/linux_dents.rs +1713 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/scan.rs +2475 -372
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/snapshot.rs +114 -3
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/stored_state.rs +21 -3
- fdu-0.3.0/crates/fdu-core/src/test_support.rs +159 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/watch.rs +114 -26
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/watch_session.rs +507 -5
- fdu-0.3.0/crates/fdu-core/tests/golden/opened-root/coherent-projections-and-continuations.golden +43 -0
- fdu-0.3.0/crates/fdu-core/tests/golden/opened-root/cold-progressive-knowledge.golden +25 -0
- fdu-0.3.0/crates/fdu-core/tests/golden/opened-root/exact-mutation-and-refresh.golden +45 -0
- fdu-0.3.0/crates/fdu-core/tests/golden/opened-root/failed-listing-and-recovery.golden +19 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/golden/opened-root/journal-and-observation-recovery.golden +11 -11
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/golden/opened-root/ownership-races-and-shutdown.golden +1 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/parallel_equivalence.rs +182 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/Cargo.toml +1 -1
- {fdu-0.2.0 → fdu-0.3.0/crates/fdu-py}/README.md +7 -1
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/src/lib.rs +9 -4
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/src/opened_binding.rs +1 -0
- fdu-0.3.0/crates/fdu-py/tests/conftest.py +25 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/public_smoke.py +28 -4
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/smoke.py +9 -1
- fdu-0.3.0/crates/fdu-py/tests/test_cache_isolation.py +17 -0
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/_api.py +16 -3
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/_models.py +12 -3
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/_native.pyi +1 -0
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/opened.py +3 -0
- fdu-0.2.0/crates/fdu-core/src/classify/file_type_detection.rs +0 -197
- fdu-0.2.0/crates/fdu-core/src/content/content_code_metrics.rs +0 -1045
- fdu-0.2.0/crates/fdu-core/src/control/gitignore.rs +0 -822
- fdu-0.2.0/crates/fdu-core/src/execution.rs +0 -2112
- fdu-0.2.0/crates/fdu-core/src/test_support.rs +0 -76
- fdu-0.2.0/crates/fdu-core/tests/golden/opened-root/coherent-projections-and-continuations.golden +0 -43
- fdu-0.2.0/crates/fdu-core/tests/golden/opened-root/cold-progressive-knowledge.golden +0 -25
- fdu-0.2.0/crates/fdu-core/tests/golden/opened-root/exact-mutation-and-refresh.golden +0 -45
- fdu-0.2.0/crates/fdu-core/tests/golden/opened-root/failed-listing-and-recovery.golden +0 -19
- {fdu-0.2.0 → fdu-0.3.0}/LICENSE +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/LICENSE +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/interrupt.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/lib.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/main.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/progress_line.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/progress_ticker.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/src/skill_install.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/cli_color.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/detached_performance_invariants.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/directory_queries.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/scan_watermark_integration.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu/tests/watch_controls.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/LICENSE +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/rules/file-types.toml +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/cache.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/classify/file_rollup_manifest.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/classify/manifest_toml.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/classify/type_rule_manifest.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/classify.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_basic_metrics.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_index.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/content/content_markdown_metrics.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/counters/alloc.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/counters/process.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/emit/emit_json.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/emit/emit_scalar.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/emit/emit_yaml.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/emit.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened/continuation.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened/golden_support.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened/golden_tests.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened/journal.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/opened/read.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/platform_tuning.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/progress.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_glob.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_request.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_status.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_subtrees.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query/query_values.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/query.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/scan/macos_bulk.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/scan/windows_metadata.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/testdata/tree-schema-v2.json +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/testdata/yaml-scalar-corpus.json +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/testdata/yaml-scalar-corpus.yaml +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/src/watch/scripted_events.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/golden/partial-tree.txt +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/golden/remainder-tree.txt +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/golden/tree-populations.txt +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/partial_directory_queries.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/query_allocations.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/reference_model.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/state_transition_regressions.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-core/tests/watch_session_integration.rs +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/LICENSE +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/examples/rollup_adapter.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/run_concurrency.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/test_directory_queries.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/test_models.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/test_readme_examples.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/test_startup.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/typecheck/consumer.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/tests/typecheck/pyrightconfig.json +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/uv.lock +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/crates/fdu-py/uv.toml +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/pyproject.toml +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/__init__.py +0 -0
- {fdu-0.2.0 → fdu-0.3.0}/python/fdu/py.typed +0 -0
|
@@ -173,7 +173,7 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
|
|
|
173
173
|
|
|
174
174
|
[[package]]
|
|
175
175
|
name = "fdu"
|
|
176
|
-
version = "0.
|
|
176
|
+
version = "0.3.0"
|
|
177
177
|
dependencies = [
|
|
178
178
|
"anstyle-query",
|
|
179
179
|
"anyhow",
|
|
@@ -187,7 +187,7 @@ dependencies = [
|
|
|
187
187
|
|
|
188
188
|
[[package]]
|
|
189
189
|
name = "fdu-core"
|
|
190
|
-
version = "0.
|
|
190
|
+
version = "0.3.0"
|
|
191
191
|
dependencies = [
|
|
192
192
|
"anstyle",
|
|
193
193
|
"libc",
|
|
@@ -200,7 +200,7 @@ dependencies = [
|
|
|
200
200
|
|
|
201
201
|
[[package]]
|
|
202
202
|
name = "fdu-py"
|
|
203
|
-
version = "0.
|
|
203
|
+
version = "0.3.0"
|
|
204
204
|
dependencies = [
|
|
205
205
|
"fdu",
|
|
206
206
|
"fdu-core",
|
|
@@ -10,8 +10,8 @@ repository = "https://github.com/jlevy/fdu"
|
|
|
10
10
|
authors = ["fdu contributors"]
|
|
11
11
|
|
|
12
12
|
[workspace.dependencies]
|
|
13
|
-
fdu-core = { version = "0.
|
|
14
|
-
fdu = { version = "0.
|
|
13
|
+
fdu-core = { version = "0.3.0", path = "crates/fdu-core", default-features = false }
|
|
14
|
+
fdu = { version = "0.3.0", path = "crates/fdu", default-features = false }
|
|
15
15
|
|
|
16
16
|
[workspace.lints.clippy]
|
|
17
17
|
pedantic = { level = "deny", priority = -1 }
|
{fdu-0.2.0 → fdu-0.3.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fdu
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Environment :: Console
|
|
6
6
|
Classifier: Operating System :: MacOS
|
|
@@ -28,7 +28,13 @@ Project-URL: Repository, https://github.com/jlevy/fdu
|
|
|
28
28
|
|
|
29
29
|
**Fastest native du replacement and detailed file analytics for Python and Rust**
|
|
30
30
|
|
|
31
|
-
Python bindings for [fdu](https://github.com/jlevy/fdu)
|
|
31
|
+
Python bindings for [fdu](https://github.com/jlevy/fdu), which reports, for every
|
|
32
|
+
directory in a tree at once, its size, file count, recency, and file kinds, and on
|
|
33
|
+
request its lines of code and prose volume.
|
|
34
|
+
It walks a tree on several threads through each platform’s native directory interface,
|
|
35
|
+
and on a million-file tree runs about 9× as fast as `du` on macOS and 2.6× as fast on
|
|
36
|
+
Linux, ahead of pdu, diskus, and dust
|
|
37
|
+
([speed](https://github.com/jlevy/fdu/blob/main/docs/speed.md)).
|
|
32
38
|
|
|
33
39
|
## Set Up with Any Coding Agent
|
|
34
40
|
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
**Fastest native du replacement and detailed file analytics for Python and Rust**
|
|
4
4
|
|
|
5
|
-
Python bindings for [fdu](https://github.com/jlevy/fdu)
|
|
5
|
+
Python bindings for [fdu](https://github.com/jlevy/fdu), which reports, for every
|
|
6
|
+
directory in a tree at once, its size, file count, recency, and file kinds, and on
|
|
7
|
+
request its lines of code and prose volume.
|
|
8
|
+
It walks a tree on several threads through each platform’s native directory interface,
|
|
9
|
+
and on a million-file tree runs about 9× as fast as `du` on macOS and 2.6× as fast on
|
|
10
|
+
Linux, ahead of pdu, diskus, and dust
|
|
11
|
+
([speed](https://github.com/jlevy/fdu/blob/main/docs/speed.md)).
|
|
6
12
|
|
|
7
13
|
## Set Up with Any Coding Agent
|
|
8
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "fdu"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.3.0"
|
|
4
4
|
# clap takes `--help`'s summary from this, so it describes the tool a user runs rather
|
|
5
5
|
# than this crate's role in the layout. The golden that pins the help text caught the
|
|
6
6
|
# difference the moment the binary moved, which is the corpus doing its job.
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
fdu answers, for *every* directory in a tree at once: how big is it, how many files does
|
|
6
6
|
it hold, what changed most recently, and what kinds of files live in it.
|
|
7
7
|
One walk, many metrics, with reusable metadata and content state.
|
|
8
|
+
It walks a tree on several threads through each platform’s native directory interface,
|
|
9
|
+
and on a million-file tree runs about 9× as fast as `du` on macOS and 2.6× as fast on
|
|
10
|
+
Linux, ahead of pdu, diskus, and dust
|
|
11
|
+
([speed](https://github.com/jlevy/fdu/blob/main/docs/speed.md)).
|
|
8
12
|
|
|
9
13
|
This crate is the `fdu` command line.
|
|
10
14
|
It is also a library that re-exports the whole
|
|
@@ -95,7 +99,7 @@ The API is documented on [docs.rs](https://docs.rs/fdu), and
|
|
|
95
99
|
analyzer, cache policy, selection, and automation contract
|
|
96
100
|
- [Repository README](https://github.com/jlevy/fdu#readme): performance evidence, cost
|
|
97
101
|
layers, and how the engine works
|
|
98
|
-
- [0.
|
|
102
|
+
- [0.3.0 release notes](https://github.com/jlevy/fdu/blob/main/docs/project/release-notes/0.3.0.md)
|
|
99
103
|
and [changelog](https://github.com/jlevy/fdu/blob/main/CHANGELOG.md)
|
|
100
104
|
- [Security policy](https://github.com/jlevy/fdu/blob/main/SECURITY.md)
|
|
101
105
|
|
|
@@ -56,7 +56,12 @@ fn emit_version() {
|
|
|
56
56
|
println!("cargo:rustc-env=FDU_BUILD_VERSION={semver}");
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
// A Python sdist carries no `.cargo_vcs_info.json`, and pip or uv may unpack it inside
|
|
60
|
+
// any repository -- even a home directory kept in git. That repository encloses this
|
|
61
|
+
// package without describing it, so its HEAD is a stranger's commit too (fdu-h2bj).
|
|
62
|
+
// Only a repository that tracks this manifest can name the revision it was built from.
|
|
63
|
+
let tracked = git(&["ls-files", "--error-unmatch", "--", "Cargo.toml"]).is_some();
|
|
64
|
+
let version = match git(&["rev-parse", "--short=9", "HEAD"]).filter(|_| tracked) {
|
|
60
65
|
Some(revision) => {
|
|
61
66
|
// This preserves Cargo's default whole-package dirty tracking after adding
|
|
62
67
|
// the narrower manifest and Git rerun directives below.
|
|
@@ -134,7 +134,16 @@ Run `fdu --docs` for setup, libraries, more commands, cache behavior, and the fu
|
|
|
134
134
|
macro_rules! docs_guide {
|
|
135
135
|
($watch_composition:literal, $mode_flags:literal) => {
|
|
136
136
|
concat!(
|
|
137
|
-
r"fdu —
|
|
137
|
+
r"fdu — the fastest du replacement, with file tree analysis.
|
|
138
|
+
|
|
139
|
+
For every directory in a tree at once, fdu reports its size, file count,
|
|
140
|
+
recency, and file kinds, and on request its lines of code and prose volume.
|
|
141
|
+
It walks the tree on several threads through each platform's native
|
|
142
|
+
directory interface; on a million-file tree it runs about 9x as fast as du
|
|
143
|
+
on macOS and 2.6x as fast on Linux, ahead of pdu, diskus, and dust.
|
|
144
|
+
Content metrics are cached between runs, and every capability is also a
|
|
145
|
+
Rust and Python API.
|
|
146
|
+
Speed details: https://github.com/jlevy/fdu/blob/main/docs/speed.md
|
|
138
147
|
|
|
139
148
|
SET UP WITH ANY CODING AGENT
|
|
140
149
|
Install fdu's self-contained skill for current and future agent sessions:
|
|
@@ -299,7 +308,8 @@ CACHE BEHAVIOR
|
|
|
299
308
|
|
|
300
309
|
--stale-ok answers from the snapshot alone: it does no filesystem verification,
|
|
301
310
|
requires a compatible snapshot and content sidecar for the requested analysis,
|
|
302
|
-
and labels its answer stale
|
|
311
|
+
and labels its answer stale with a warn: line on stderr that --quiet keeps.
|
|
312
|
+
--cache=off neither reads nor writes fdu's cache.
|
|
303
313
|
|
|
304
314
|
macOS and Linux default to ~/.cache/fdu; Windows uses %LOCALAPPDATA%/fdu.
|
|
305
315
|
--cache-dir overrides FDU_CACHE_DIR, then XDG_CACHE_HOME/fdu and native defaults.
|
|
@@ -315,11 +325,12 @@ IGNORE RULES
|
|
|
315
325
|
--ignored=only discovers gitignored matches through ordinary ancestors, reading
|
|
316
326
|
only gitignored bodies for analysis. Sort and --min-size follow the size shown.
|
|
317
327
|
--no-gitignore reads no rules and shows no share. Only per-directory .gitignore
|
|
318
|
-
files apply, not core.excludesFile, .git/info/exclude, or a global ignore file
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
328
|
+
files apply, not core.excludesFile, .git/info/exclude, or a global ignore file.
|
|
329
|
+
Each is found as git opens it, so a .GITIGNORE counts on a case-insensitive
|
|
330
|
+
volume; matching itself is case-sensitive on every platform. An unreadable
|
|
331
|
+
.gitignore makes the result partial, like any unreadable path. A .gitignore past
|
|
332
|
+
--gitignore-budget or --gitignore-line-limit is refused whole and named in a note:
|
|
333
|
+
sizes stay exact, gitignored shares under that directory do not.
|
|
323
334
|
|
|
324
335
|
OUTPUT AND AUTOMATION
|
|
325
336
|
Every machine report uses fdu.report/10; watch changes use fdu.stream/2.
|
|
@@ -1040,7 +1051,6 @@ impl Cli {
|
|
|
1040
1051
|
presentation: WatchPresentation,
|
|
1041
1052
|
) -> anyhow::Result<RunOutcome> {
|
|
1042
1053
|
use fdu_core::query::ViewSpec;
|
|
1043
|
-
use fdu_core::watch_session::Session;
|
|
1044
1054
|
|
|
1045
1055
|
let WatchPresentation { render, diagnostic_color, quiet } = presentation;
|
|
1046
1056
|
|
|
@@ -1052,20 +1062,8 @@ impl Cli {
|
|
|
1052
1062
|
.expect("run() builds a watch delivery before it takes the watch path")
|
|
1053
1063
|
.interval;
|
|
1054
1064
|
|
|
1055
|
-
let mut session =
|
|
1056
|
-
|
|
1057
|
-
// The one place the line is stopped on this route: right after the start
|
|
1058
|
-
// returns, with a session or with an error, and before the startup save's
|
|
1059
|
-
// warning, the first report, or anything else reaches either stream.
|
|
1060
|
-
let progress = Progress::new();
|
|
1061
|
-
let mut ticker = Ticker::start(plan, progress.clone(), Instant::now(), progress_io);
|
|
1062
|
-
let session =
|
|
1063
|
-
Session::start_with_progress(request.clone(), delivery.clone(), &progress);
|
|
1064
|
-
ticker.stop();
|
|
1065
|
-
session?
|
|
1066
|
-
}
|
|
1067
|
-
None => Session::start(request.clone(), delivery.clone())?,
|
|
1068
|
-
};
|
|
1065
|
+
let (mut session, initial) =
|
|
1066
|
+
Self::start_watch(request, delivery, format, render, indicator)?;
|
|
1069
1067
|
Self::persist_live(&mut session, diagnostic, diagnostic_color);
|
|
1070
1068
|
|
|
1071
1069
|
// A streaming run keeps only the views it can render incrementally plus the
|
|
@@ -1081,11 +1079,12 @@ impl Cli {
|
|
|
1081
1079
|
let has_aggregates =
|
|
1082
1080
|
!streams_changes || request.query.views.iter().any(|view| *view != ViewSpec::Files);
|
|
1083
1081
|
|
|
1084
|
-
// The initial answer, identical to a one-shot run's
|
|
1082
|
+
// The initial answer, identical to a one-shot run's, which the start above built
|
|
1083
|
+
// as a repaint so the session holds it as the answer every later repaint is
|
|
1084
|
+
// measured against.
|
|
1085
1085
|
if format == report_format::Format::Yaml {
|
|
1086
1086
|
write!(out, "{}", report_format::document_start(format))?;
|
|
1087
1087
|
}
|
|
1088
|
-
let initial = session.report(SystemTime::now())?;
|
|
1089
1088
|
report_format::write_with_options(&initial, format, render, out)?;
|
|
1090
1089
|
out.flush()?;
|
|
1091
1090
|
write_report_diagnostics(diagnostic, &initial, format, diagnostic_color, None, quiet)?;
|
|
@@ -1100,7 +1099,7 @@ impl Cli {
|
|
|
1100
1099
|
Self::render_live(
|
|
1101
1100
|
out,
|
|
1102
1101
|
diagnostic,
|
|
1103
|
-
&session,
|
|
1102
|
+
&mut session,
|
|
1104
1103
|
format,
|
|
1105
1104
|
render,
|
|
1106
1105
|
diagnostic_color,
|
|
@@ -1126,7 +1125,7 @@ impl Cli {
|
|
|
1126
1125
|
Self::render_live(
|
|
1127
1126
|
out,
|
|
1128
1127
|
diagnostic,
|
|
1129
|
-
&session,
|
|
1128
|
+
&mut session,
|
|
1130
1129
|
format,
|
|
1131
1130
|
render,
|
|
1132
1131
|
diagnostic_color,
|
|
@@ -1146,6 +1145,50 @@ impl Cli {
|
|
|
1146
1145
|
}
|
|
1147
1146
|
}
|
|
1148
1147
|
|
|
1148
|
+
/// Start the session and build its first answer, under the progress line when the
|
|
1149
|
+
/// run draws one.
|
|
1150
|
+
///
|
|
1151
|
+
/// The one place the line is stopped on this route: once the first answer exists, or
|
|
1152
|
+
/// the start or the build has failed, and before the startup save's warning, that
|
|
1153
|
+
/// answer, or anything else reaches either stream. The build is under the line
|
|
1154
|
+
/// because it is part of the wait: a heavy view over a large tree takes seconds to
|
|
1155
|
+
/// build, and a line stopped when the start returned went blank for them
|
|
1156
|
+
/// (fdu-wku3). The answer is asked for as a repaint so the session holds it as the
|
|
1157
|
+
/// one every later repaint is measured against.
|
|
1158
|
+
#[cfg(feature = "watch")]
|
|
1159
|
+
fn start_watch(
|
|
1160
|
+
request: &Request,
|
|
1161
|
+
delivery: &Delivery,
|
|
1162
|
+
format: report_format::Format,
|
|
1163
|
+
render: report_format::RenderOptions,
|
|
1164
|
+
indicator: Option<(ProgressPlan, ProgressIo)>,
|
|
1165
|
+
) -> anyhow::Result<(fdu_core::watch_session::Session, Report)> {
|
|
1166
|
+
use fdu_core::watch_session::Session;
|
|
1167
|
+
|
|
1168
|
+
let (session, answer) = if let Some((plan, progress_io)) = indicator {
|
|
1169
|
+
let progress = Progress::new();
|
|
1170
|
+
let mut ticker = Ticker::start(plan, progress.clone(), Instant::now(), progress_io);
|
|
1171
|
+
let started =
|
|
1172
|
+
Session::start_with_progress(request.clone(), delivery.clone(), &progress)
|
|
1173
|
+
.and_then(|mut session| {
|
|
1174
|
+
let answer = session.changed_report_with_progress(
|
|
1175
|
+
SystemTime::now(),
|
|
1176
|
+
format,
|
|
1177
|
+
render,
|
|
1178
|
+
&progress,
|
|
1179
|
+
)?;
|
|
1180
|
+
Ok((session, answer))
|
|
1181
|
+
});
|
|
1182
|
+
ticker.stop();
|
|
1183
|
+
started?
|
|
1184
|
+
} else {
|
|
1185
|
+
let mut session = Session::start(request.clone(), delivery.clone())?;
|
|
1186
|
+
let answer = session.changed_report(SystemTime::now(), format, render)?;
|
|
1187
|
+
(session, answer)
|
|
1188
|
+
};
|
|
1189
|
+
Ok((session, answer.expect("a session's first answer is always given")))
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1149
1192
|
/// Surface a persistence failure without interrupting the live answer.
|
|
1150
1193
|
#[cfg(feature = "watch")]
|
|
1151
1194
|
fn persist_live(
|
|
@@ -1188,18 +1231,24 @@ impl Cli {
|
|
|
1188
1231
|
/// Repaint the aggregate views after a change.
|
|
1189
1232
|
///
|
|
1190
1233
|
/// Only ever called for a repaint — the first answer is written by the caller before
|
|
1191
|
-
/// the loop — so the rule below can be unconditional.
|
|
1234
|
+
/// the loop — so the rule below can be unconditional. A change that leaves the answer
|
|
1235
|
+
/// as the reader last saw it, such as a touch that moves no size, repaints nothing:
|
|
1236
|
+
/// the engine's session decides that (`Session::changed_report`), not this command
|
|
1237
|
+
/// line (fdu-wb5n). Python's `Watch.report` does not take that rule; it always
|
|
1238
|
+
/// answers.
|
|
1192
1239
|
fn render_live(
|
|
1193
1240
|
out: &mut dyn Write,
|
|
1194
1241
|
diagnostic: &mut dyn Write,
|
|
1195
|
-
session: &fdu_core::watch_session::Session,
|
|
1242
|
+
session: &mut fdu_core::watch_session::Session,
|
|
1196
1243
|
format: report_format::Format,
|
|
1197
1244
|
render: report_format::RenderOptions,
|
|
1198
1245
|
diagnostic_color: bool,
|
|
1199
1246
|
quiet: bool,
|
|
1200
1247
|
) -> anyhow::Result<()> {
|
|
1201
1248
|
let generated_at = SystemTime::now();
|
|
1202
|
-
let report = session.
|
|
1249
|
+
let Some(report) = session.changed_report(generated_at, format, render)? else {
|
|
1250
|
+
return Ok(());
|
|
1251
|
+
};
|
|
1203
1252
|
// A watch run has no final answer and so no performance footer, which left text
|
|
1204
1253
|
// repaints with nothing between them: the last row of one and the first row of
|
|
1205
1254
|
// the next were adjacent lines. A blank line alone would not do, because that is
|
|
@@ -1742,9 +1791,14 @@ fn resolve_views(spec: Option<&str>, profile: AnalysisSet) -> anyhow::Result<Res
|
|
|
1742
1791
|
Ok(ResolvedViews { selected, omitted })
|
|
1743
1792
|
}
|
|
1744
1793
|
|
|
1745
|
-
/// Output-design boundary: flush result stdout before emitting notes,
|
|
1746
|
-
///
|
|
1747
|
-
///
|
|
1794
|
+
/// Output-design boundary: flush result stdout before emitting notes, warnings, and
|
|
1795
|
+
/// deduplicated tips to stderr. The caller appends `perf:` last for human one-shot
|
|
1796
|
+
/// reports. Machine stdout receives no diagnostics or terminal escapes.
|
|
1797
|
+
///
|
|
1798
|
+
/// Warnings come from two owners: the engine's [`report_format::report_warnings`], which
|
|
1799
|
+
/// describe the answer itself (a `--stale-ok` answer nothing verified), then this
|
|
1800
|
+
/// frontend's operational ones (a failed save, each retained status issue). `--quiet`
|
|
1801
|
+
/// keeps every warning, on every format, and drops only notes, tips, and `perf:`.
|
|
1748
1802
|
///
|
|
1749
1803
|
/// Use stderr's color decision: note/tip/perf are gray, warn is yellow without bold,
|
|
1750
1804
|
/// and fatal rendering in `finish` is red bold. Preserve paths and causes on warning
|
|
@@ -1767,6 +1821,9 @@ fn write_report_diagnostics(
|
|
|
1767
1821
|
writeln!(diagnostic, "{}", paint(&line, STYLE_PERFORMANCE, color))?;
|
|
1768
1822
|
}
|
|
1769
1823
|
}
|
|
1824
|
+
for warning in report_format::report_warnings(report) {
|
|
1825
|
+
writeln!(diagnostic, "{}", paint(&warning, STYLE_WARNING, color))?;
|
|
1826
|
+
}
|
|
1770
1827
|
if let Some(warning) = save_warning {
|
|
1771
1828
|
writeln!(diagnostic, "{}", paint(warning, STYLE_WARNING, color))?;
|
|
1772
1829
|
}
|
|
@@ -3193,6 +3250,71 @@ mod tests {
|
|
|
3193
3250
|
);
|
|
3194
3251
|
}
|
|
3195
3252
|
|
|
3253
|
+
/// A `--stale-ok` answer is marked on stderr by a warning that `--quiet` keeps, on the
|
|
3254
|
+
/// plain text report and every other format, and a verified answer carries no such
|
|
3255
|
+
/// line. Before this, plain text said only `cache only` at the end of the `perf:`
|
|
3256
|
+
/// footer, and `--quiet` removed that too (fdu-mdop).
|
|
3257
|
+
#[test]
|
|
3258
|
+
fn quiet_keeps_the_stale_answer_warning_and_a_verified_answer_has_none() {
|
|
3259
|
+
const WARNING: &str = "warn: stale answer: served from the snapshot without filesystem \
|
|
3260
|
+
verification; drop --stale-ok for a fresh answer\n";
|
|
3261
|
+
let root = tempfile::tempdir().expect("tempdir");
|
|
3262
|
+
std::fs::write(root.path().join("one.txt"), b"one\n").expect("write");
|
|
3263
|
+
let cache = tempfile::tempdir().expect("cache dir");
|
|
3264
|
+
let command = |view: &str, format: &str, cache_policy: &str, stale_ok, quiet| Cli {
|
|
3265
|
+
path: Some(root.path().to_path_buf()),
|
|
3266
|
+
view: Some(view.to_string()),
|
|
3267
|
+
format: format.to_string(),
|
|
3268
|
+
size: "apparent".to_string(),
|
|
3269
|
+
cache: cache_policy.to_string(),
|
|
3270
|
+
cache_dir: Some(cache.path().to_path_buf()),
|
|
3271
|
+
stale_ok,
|
|
3272
|
+
quiet,
|
|
3273
|
+
..cli()
|
|
3274
|
+
};
|
|
3275
|
+
let run = |command: Cli| {
|
|
3276
|
+
let (mut out, mut diagnostic) = (Vec::new(), Vec::new());
|
|
3277
|
+
command
|
|
3278
|
+
.run(
|
|
3279
|
+
&mut out,
|
|
3280
|
+
&mut diagnostic,
|
|
3281
|
+
false,
|
|
3282
|
+
&TerminalFacts::default(),
|
|
3283
|
+
ProgressIo::inert(),
|
|
3284
|
+
)
|
|
3285
|
+
.expect("report");
|
|
3286
|
+
(
|
|
3287
|
+
String::from_utf8(out).expect("UTF-8 stdout"),
|
|
3288
|
+
String::from_utf8(diagnostic).expect("UTF-8 stderr"),
|
|
3289
|
+
)
|
|
3290
|
+
};
|
|
3291
|
+
|
|
3292
|
+
// `on` leaves the snapshot a stale answer reads; its own answer is verified.
|
|
3293
|
+
let (_, seeded) = run(command("tree", "text", "on", false, false));
|
|
3294
|
+
assert!(!seeded.contains("warn:"), "a cold scan is not stale: {seeded}");
|
|
3295
|
+
let (fresh_out, fresh) = run(command("summary", "text", "auto", false, false));
|
|
3296
|
+
assert!(!fresh.contains("warn:"), "a verified answer is not stale: {fresh}");
|
|
3297
|
+
let (_, fresh_quiet) = run(command("summary", "text", "auto", false, true));
|
|
3298
|
+
assert!(fresh_quiet.is_empty(), "nothing to keep: {fresh_quiet:?}");
|
|
3299
|
+
|
|
3300
|
+
let (stale_out, stale) = run(command("summary", "text", "auto", true, false));
|
|
3301
|
+
assert_eq!(stale_out, fresh_out, "an unchanged tree gives the same answer");
|
|
3302
|
+
let warning = stale.find(WARNING).unwrap_or_else(|| panic!("stale marker: {stale}"));
|
|
3303
|
+
let perf = stale.find("perf:").expect("a text report closes with perf:");
|
|
3304
|
+
assert!(warning < perf, "warnings precede the performance footer: {stale}");
|
|
3305
|
+
assert!(stale.trim_end().ends_with("cache only"), "{stale}");
|
|
3306
|
+
|
|
3307
|
+
let (quiet_out, quiet) = run(command("summary", "text", "auto", true, true));
|
|
3308
|
+
assert_eq!(quiet_out, stale_out, "quiet leaves result stdout intact");
|
|
3309
|
+
assert_eq!(quiet, WARNING, "quiet keeps the stale marker and nothing else");
|
|
3310
|
+
for (view, format) in [("summary", "json"), ("list", "paths")] {
|
|
3311
|
+
let (_, quiet) = run(command(view, format, "auto", true, true));
|
|
3312
|
+
assert_eq!(quiet, WARNING, "{format} keeps the same marker under quiet");
|
|
3313
|
+
let (_, fresh_quiet) = run(command(view, format, "auto", false, true));
|
|
3314
|
+
assert!(!fresh_quiet.contains("warn:"), "{format}: {fresh_quiet}");
|
|
3315
|
+
}
|
|
3316
|
+
}
|
|
3317
|
+
|
|
3196
3318
|
/// The footer's walked size is measured as the answer is, so it reads as the summary
|
|
3197
3319
|
/// row's own total under the default and under `--size apparent` alike. (On Windows
|
|
3198
3320
|
/// allocated falls back to apparent, and the two readings agree.)
|
|
@@ -4088,6 +4210,72 @@ mod tests {
|
|
|
4088
4210
|
assert_eq!(&text[error..], "fdu: output failed\n");
|
|
4089
4211
|
}
|
|
4090
4212
|
|
|
4213
|
+
/// A watch start keeps its line up while the first answer is built (fdu-wku3): the
|
|
4214
|
+
/// build is drawn as `Summarizing` under the line the start drew, and the line is
|
|
4215
|
+
/// erased once the answer exists, before anything is written.
|
|
4216
|
+
#[cfg(feature = "watch")]
|
|
4217
|
+
#[test]
|
|
4218
|
+
fn a_watch_start_draws_through_its_first_answer_and_stops_before_writing_it() {
|
|
4219
|
+
let root = wide_tree();
|
|
4220
|
+
let command = parse(&[
|
|
4221
|
+
"fdu",
|
|
4222
|
+
"--watch",
|
|
4223
|
+
"--view",
|
|
4224
|
+
"files",
|
|
4225
|
+
"--cache",
|
|
4226
|
+
"off",
|
|
4227
|
+
"--color",
|
|
4228
|
+
"never",
|
|
4229
|
+
"--progress",
|
|
4230
|
+
"always",
|
|
4231
|
+
root.path().to_str().expect("Unicode"),
|
|
4232
|
+
]);
|
|
4233
|
+
let request = command.request(root.path(), SystemTime::now()).expect("request");
|
|
4234
|
+
let delivery = Delivery {
|
|
4235
|
+
cache: CachePolicy::Off,
|
|
4236
|
+
stale_ok: false,
|
|
4237
|
+
cache_path: None,
|
|
4238
|
+
workers: fdu_core::query::Workers::default(),
|
|
4239
|
+
batch_size: fdu_core::ScanConfig::default().batch_size,
|
|
4240
|
+
order: fdu_core::ScanOrder::default(),
|
|
4241
|
+
watch: command.watch_delivery().expect("watch delivery"),
|
|
4242
|
+
accept_partial: false,
|
|
4243
|
+
};
|
|
4244
|
+
let render = report_format::RenderOptions { color: false, bar_size: 0 };
|
|
4245
|
+
|
|
4246
|
+
// Whether the ticker thread is scheduled during the build is up to the OS, as
|
|
4247
|
+
// with the one-shot orderings above: a few runs, and a runner whose frames never
|
|
4248
|
+
// reach the build in five is a result worth failing on.
|
|
4249
|
+
let mut texts = Vec::new();
|
|
4250
|
+
for _ in 0..5 {
|
|
4251
|
+
let err = SharedBuffer::default();
|
|
4252
|
+
let plan = command.progress_plan(&interactive_terminal(), &request);
|
|
4253
|
+
assert!(plan.draw, "an interactive watch start draws");
|
|
4254
|
+
let (session, answer) = Cli::start_watch(
|
|
4255
|
+
&request,
|
|
4256
|
+
&delivery,
|
|
4257
|
+
report_format::Format::Text,
|
|
4258
|
+
render,
|
|
4259
|
+
Some((plan, drawing_io(&err))),
|
|
4260
|
+
)
|
|
4261
|
+
.expect("a watch start");
|
|
4262
|
+
drop(session);
|
|
4263
|
+
let text = err.text();
|
|
4264
|
+
assert!(!answer.sections.is_empty(), "the start built the first answer");
|
|
4265
|
+
if drawn_frames(&text) >= 1 {
|
|
4266
|
+
assert!(
|
|
4267
|
+
text.ends_with(ERASE_LINE),
|
|
4268
|
+
"the line is erased once the answer exists:\n{text:?}"
|
|
4269
|
+
);
|
|
4270
|
+
}
|
|
4271
|
+
if text.contains("Summarizing") {
|
|
4272
|
+
return;
|
|
4273
|
+
}
|
|
4274
|
+
texts.push(text);
|
|
4275
|
+
}
|
|
4276
|
+
panic!("no frame showed the first answer's build in five runs: {texts:?}");
|
|
4277
|
+
}
|
|
4278
|
+
|
|
4091
4279
|
/// The same run, the same tree, and the same drawing resources, but no person at
|
|
4092
4280
|
/// the terminal: only diagnostics reach stderr, whatever `--progress` says.
|
|
4093
4281
|
#[test]
|
|
@@ -13,6 +13,10 @@ This is the complete fdu usage contract; it needs no setup chat or prior session
|
|
|
13
13
|
context.
|
|
14
14
|
|
|
15
15
|
Use `fdu` to summarize a directory tree without modifying files in that tree.
|
|
16
|
+
It reports size, file count, recency, and file kinds for every directory at once, and
|
|
17
|
+
walks the tree on several threads through each platform’s native directory interface: on
|
|
18
|
+
a million-file tree it runs about 9× as fast as `du` on macOS and 2.6× as fast on Linux,
|
|
19
|
+
ahead of pdu, diskus, and dust.
|
|
16
20
|
`fdu --docs` prints common commands, cache behavior, and the full usage contract without
|
|
17
21
|
a PATH and without scanning.
|
|
18
22
|
Every report requires an explicit `PATH`; bare `fdu` prints help instead of scanning the
|
|
@@ -150,16 +154,19 @@ bodies may be skipped.
|
|
|
150
154
|
A retained index can answer narrower queries when it holds the required facts.
|
|
151
155
|
|
|
152
156
|
Work has three layers.
|
|
153
|
-
A single unfiltered `--
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
A single unfiltered `--view summary PATH` is the one exact composition that retains only
|
|
158
|
+
aggregate tallies and no index, except under `--cache on` and `--stale-ok`, whose
|
|
159
|
+
contracts are about the snapshot itself.
|
|
156
160
|
Otherwise a snapshot cannot save the walk that request is already doing, so it neither
|
|
157
161
|
reads nor writes one.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
Reading `.gitignore`, the summary keeps the rules and classifies each entry as it counts
|
|
163
|
+
it, so its ignored share needs no index either.
|
|
164
|
+
An unfiltered tree with a share floor, such as the default `fdu PATH`, keeps every
|
|
165
|
+
directory but only the files large enough to show as rows; other metadata requests
|
|
166
|
+
retain the reusable index.
|
|
167
|
+
None of them reads regular-file contents.
|
|
168
|
+
One-shot metadata reports under `auto` neither load a snapshot, which cannot avoid the
|
|
169
|
+
current metadata walk, nor write one; `--cache on` writes one.
|
|
163
170
|
Any `--analyze` value other than `none` opts into a separate content sidecar.
|
|
164
171
|
fdu reads eligible files whose requested result is absent or stale; a compatible
|
|
165
172
|
repeated run reuses unchanged records.
|
|
@@ -230,6 +237,8 @@ analysis. `--view full` includes Code only with code analysis and Documents with
|
|
|
230
237
|
analyzer, naming inapplicable views as skipped.
|
|
231
238
|
Use `--workers` to bound concurrent reads and `--words-per-page` to control page
|
|
232
239
|
derivation. Analysis never truncates a file or excludes it because of size.
|
|
240
|
+
One fixed bound changes a method: `words` counts a Markdown file over 64 MiB as plain
|
|
241
|
+
text, read whole but not rendered, and says so (`counted as text`, `text_only`, a note).
|
|
233
242
|
Invalid UTF-8, binary data, and unsupported SLOC languages remain visible as normal
|
|
234
243
|
coverage outcomes. Only I/O failures, files changed during a read, or stale commits make
|
|
235
244
|
analysis operationally partial.
|
|
@@ -357,7 +366,9 @@ The default `include` measures both populations and reports their contributions
|
|
|
357
366
|
separately. Unknown classifications cannot justify pruning.
|
|
358
367
|
`--no-gitignore` with either selection is a usage error.
|
|
359
368
|
Only per-directory `.gitignore` files apply, not `core.excludesFile`,
|
|
360
|
-
`.git/info/exclude`, or a global ignore file
|
|
369
|
+
`.git/info/exclude`, or a global ignore file.
|
|
370
|
+
Each is found as git opens it, so a `.GITIGNORE` counts on a case-insensitive volume;
|
|
371
|
+
matching itself is case-sensitive.
|
|
361
372
|
Unignored does not mean tracked: `.git` is unignored unless a rule names it.
|
|
362
373
|
For recent working files, add both `--ignored=exclude` and `--exclude='.git/**'`. An
|
|
363
374
|
unreadable `.gitignore` makes the result partial (exit 2), while one past
|
|
@@ -418,7 +429,8 @@ Check the process exit status and these fields:
|
|
|
418
429
|
|
|
419
430
|
`provenance.source` is `cold_scan`, `warm_revalidate`, or `cache_only`. Only
|
|
420
431
|
`--stale-ok` can return `provenance.freshness: stale`, and it says so rather than
|
|
421
|
-
implying currency
|
|
432
|
+
implying currency: every format also prints a `warn: stale answer` line on stderr, which
|
|
433
|
+
`--quiet` keeps. It fails outright when no usable snapshot exists rather than silently
|
|
422
434
|
scanning.
|
|
423
435
|
|
|
424
436
|
Exit 0 is accepted success, exit 1 is a fatal failure, and exit 2 is incomplete data or
|
|
@@ -432,7 +444,8 @@ No ordinary view requires a preexisting cache.
|
|
|
432
444
|
Metadata-only one-shot reports include current sizes or timestamps, so they must inspect
|
|
433
445
|
every entry; under `auto` they neither load a snapshot, which cannot make that
|
|
434
446
|
verification cheaper, nor write one, which no later report reads.
|
|
435
|
-
Content analysis, `--watch`, and
|
|
447
|
+
Content analysis, `--watch`, and a retained index from the Rust or Python `open` read,
|
|
448
|
+
revalidate, and write it.
|
|
436
449
|
`--cache on` also writes after a one-shot report, which is how to leave a snapshot for a
|
|
437
450
|
later `--stale-ok` answer.
|
|
438
451
|
|
|
@@ -100,7 +100,7 @@ fn partial_results_use_exit_two_unless_explicitly_allowed() {
|
|
|
100
100
|
assert!(traced_stdout.contains("\"complete\": false"), "{traced_stdout}");
|
|
101
101
|
assert!(traced_stdout.contains("/denied"), "{traced_stdout}");
|
|
102
102
|
assert!(
|
|
103
|
-
traced_stderr.contains("__FDU_SCAN_DIAGNOSTICS__={\"backend\":{\"
|
|
103
|
+
traced_stderr.contains("__FDU_SCAN_DIAGNOSTICS__={\"backend\":{\"linux_dents_attempts\":"),
|
|
104
104
|
"{traced_stderr}"
|
|
105
105
|
);
|
|
106
106
|
assert!(traced_stderr.contains("\"schema\":\"fdu-scan-diagnostics-v1\""), "{traced_stderr}");
|
|
@@ -317,3 +317,73 @@ fn only_ignored_code_analysis_is_complete_across_cache_routes() {
|
|
|
317
317
|
assert!(stdout.contains("\"complete\": true"), "{policy}: {stdout}");
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
|
+
|
|
321
|
+
/// Three sparse files that claim more apparent bytes together than a `u64` can hold, in
|
|
322
|
+
/// a directory on a filesystem that lets this process create them, or `None` with the
|
|
323
|
+
/// reason printed.
|
|
324
|
+
///
|
|
325
|
+
/// tmpfs, XFS, and btrfs accept an 8 EiB sparse file from anyone and allocate nothing
|
|
326
|
+
/// for it; ext4 refuses one with `EFBIG`, and other filesystems cap a file far lower. So
|
|
327
|
+
/// the fixture is tried in the system temporary directory and then in `/dev/shm`, a
|
|
328
|
+
/// tmpfs on every Linux host this is tested on, and a host with neither is said to be
|
|
329
|
+
/// skipped rather than passed.
|
|
330
|
+
fn unrepresentable_sparse_tree() -> Option<tempfile::TempDir> {
|
|
331
|
+
let size = u64::try_from(i64::MAX).expect("positive");
|
|
332
|
+
let mut refusals = Vec::new();
|
|
333
|
+
for base in [std::env::temp_dir(), std::path::PathBuf::from("/dev/shm")] {
|
|
334
|
+
let directory = match tempfile::tempdir_in(&base) {
|
|
335
|
+
Ok(directory) => directory,
|
|
336
|
+
Err(error) => {
|
|
337
|
+
refusals.push(format!("{}: {error}", base.display()));
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
let created = ["a", "b", "c"].iter().try_for_each(|name| {
|
|
342
|
+
fs::File::create(directory.path().join(name)).and_then(|file| file.set_len(size))
|
|
343
|
+
});
|
|
344
|
+
match created {
|
|
345
|
+
Ok(()) => return Some(directory),
|
|
346
|
+
Err(error) => refusals.push(format!("{}: {error}", base.display())),
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
eprintln!(
|
|
350
|
+
"skipped: no filesystem this test can write to holds three sparse files of 8 EiB \
|
|
351
|
+
apparent each ({})",
|
|
352
|
+
refusals.join("; ")
|
|
353
|
+
);
|
|
354
|
+
None
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/// A tree whose apparent bytes no `u64` can hold fails every route alike, with exit 1
|
|
358
|
+
/// and the same error, rather than wrapping the total on the routes a one-shot report
|
|
359
|
+
/// takes and refusing it only where a batch is committed (fdu-sqyk).
|
|
360
|
+
#[test]
|
|
361
|
+
fn a_total_no_u64_can_hold_fails_every_route_alike() {
|
|
362
|
+
let Some(tree) = unrepresentable_sparse_tree() else { return };
|
|
363
|
+
let cache = tempfile::tempdir().expect("cache directory");
|
|
364
|
+
let cache_dir = cache.path().to_str().expect("UTF-8 cache path");
|
|
365
|
+
let routes: [&[&str]; 7] = [
|
|
366
|
+
&["--cache", "off"],
|
|
367
|
+
&["--cache", "off", "--size", "apparent", "--format", "json"],
|
|
368
|
+
&["--cache", "off", "--view", "summary"],
|
|
369
|
+
&["--cache", "off", "--view", "summary", "--no-gitignore"],
|
|
370
|
+
&["--cache", "off", "--view", "files"],
|
|
371
|
+
&["--cache", "off", "--ignored", "exclude"],
|
|
372
|
+
&["--cache", "on", "--cache-dir", cache_dir, "--view", "files"],
|
|
373
|
+
];
|
|
374
|
+
for route in routes {
|
|
375
|
+
let output = Command::new(env!("CARGO_BIN_EXE_fdu"))
|
|
376
|
+
.args(["--color", "never"])
|
|
377
|
+
.args(route)
|
|
378
|
+
.arg(tree.path())
|
|
379
|
+
.output()
|
|
380
|
+
.expect("run fdu");
|
|
381
|
+
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
382
|
+
assert_eq!(output.status.code(), Some(1), "{route:?}: {stderr}");
|
|
383
|
+
assert!(output.stdout.is_empty(), "{route:?} printed an answer");
|
|
384
|
+
assert!(
|
|
385
|
+
stderr.contains("would carry the tree's bytes total past what a u64 can hold"),
|
|
386
|
+
"{route:?}: {stderr}"
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
}
|