Skip to main content

Module churn

Module churn 

Source
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§

AuthorContribution
Per-author commit aggregation for a single file.
ChurnResult
Result of churn analysis.
FileChurn
Per-file churn data collected from git history.
SinceDuration
Parsed duration for the --since flag.

Enums§

ChurnTrend
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 --numstat scan 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 --since value into a git-compatible duration.
set_spawn_hook
Install a spawn-hook that wraps the git log subprocess. Idempotent; subsequent calls are no-ops. Called once from the CLI’s main() to route through the signal registry; defaults to Command::output when not set so the function-pointer indirection stays free for tests and embedders that don’t care.

Type Aliases§

ChurnSpawnHook
Function pointer signature used by set_spawn_hook to intercept the git log --numstat subprocess. Lets the CLI route long-running git log calls through its ScopedChild registry so SIGINT / SIGTERM reap the subprocess instead of leaving it running after the parent exits. See crates/cli/src/signal/ and issue #477.