Expand description
Git churn analysis for hotspot detection.
Shells out to git log to collect per-file change history, then computes
recency-weighted churn scores and trend indicators.
Structs§
- Author
Contribution - Per-author commit aggregation for a single file.
- Churn
Result - Result of churn analysis.
- File
Churn - Per-file churn data collected from git history.
- Since
Duration - Parsed duration for the
--sinceflag.
Enums§
- Churn
Trend - Churn trend indicator based on comparing recent vs older halves of the analysis period.
Functions§
- analyze_
churn - Analyze git churn for files in the given root directory.
- analyze_
churn_ cached - Analyze churn with disk caching. Uses cached result when HEAD SHA and
since duration match. If HEAD advanced from the cached SHA, runs an
incremental
git log <cached>..HEAD --numstatscan and merges it. - is_
git_ repo - Check if the directory is inside a git repository.
- is_
shallow_ clone - Check if the repository is a shallow clone.
- parse_
since - Parse a
--sincevalue into a git-compatible duration. - set_
spawn_ hook - Install a spawn-hook that wraps the
git logsubprocess. Idempotent; subsequent calls are no-ops. Called once from the CLI’smain()to route through the signal registry; defaults toCommand::outputwhen not set so the function-pointer indirection stays free for tests and embedders that don’t care.
Type Aliases§
- Churn
Spawn Hook - Function pointer signature used by
set_spawn_hookto intercept thegit log --numstatsubprocess. Lets the CLI route long-running git log calls through itsScopedChildregistry so SIGINT / SIGTERM reap the subprocess instead of leaving it running after the parent exits. Seecrates/cli/src/signal/and issue #477.