Git repository status for shell prompt integration, built on the git
core reader.
Provides prompt_status() which returns the status table
shape used by the shell prompt git block: branch, tracking branch,
tag (describe), staged/modified/untracked counts, ahead/behind.
Heavily cached: a per-cwd debounce cache, an mtime+content-validated git-state cache, and a gitignore rule cache.
Includes a gitignore matching engine for untracked-file counting.
| Name | Signature |
|---|---|
| configure | configure(opts) |
| prompt_status | prompt_status(start_path) -> status |
| invalidate_prompt_cache | invalidate_prompt_cache() |
configure(
opts)
Configure the git module's cache sizes and skip thresholds
Updates internal configuration from a table of options. Valid keys:
max_prompt_cache — LRU size for prompt_status results (default: 3)max_git_cache — LRU size for parsed git state objects (default: 5)untracked_skip_threshold — skip untracked-file counting when the
working tree contains more files than this limit (default: 10000)modified_skip_threshold — same for modified-file counting (default: 50000)Unknown keys and type mismatches are silently ignored.
prompt_status(
start_path) ->status
Get git repository status for shell prompt display
Returns a table with fields: branch, remote_branch, tag,
staged, modified, untracked, ahead, behind, clean.
Returns nil if not inside a git repository.
Results are debounced (at most one full computation per second)
and internally cached by git-object mtimes. Call
invalidate_prompt_cache() to force a fresh computation on the
next call (e.g. after a command finishes).
invalidate_prompt_cache()
Clear the prompt_status debounce cache