Expand description
Which files changed, in git terms.
Every command in drep that looks at “what changed” comes through here.
drep check --staged for a pre-commit hook, --diff <ref> for a pre-push
gate, and the cache key that deduplicates repeated LLM calls all need a
stable answer to the same question. They shell out to git directly —
tokio::process::Command rather than libgit2, because the only operations
drep needs are the ones git’s own CLI was built for, and a git CLI that
misbehaves would surface as a real OS-level error rather than a translated
library one.
Two invariants matter more than the implementations:
- “No files changed” must be distinct from “I could not ask git”. Conflating them is how a commit gate rubber-stamps the day the user’s git install breaks.
current_commit_shais the one place this is reversed: it only feeds a cache key, and a cache-key component must never take the analysis down.
Modules§
- hunks
- Diff hunks: the structured form of a unified diff, and the parser that produces it.
Enums§
- GitError
- What went wrong shelling out to git.
Constants§
- CONTEXT_
LINES - How many lines of unchanged context to request around each change.
Functions§
- changed_
since - Files changed on this branch relative to
git_ref, relative toroot. - current_
commit_ sha - The current commit’s SHA, with
"unknown"on any failure. - hunks_
between - Hunks between
git_refand an explicittip, orHEADwhentipisNone. - hunks_
since - Hunks for what this branch changed relative to
git_ref. - staged_
files - Files staged for commit, relative to
root, that drep analyzes. - staged_
hunks - Hunks for the files staged for commit.