Computes git status for all files under a directory tree.
Runs git status --porcelain=v1 and parses the output into a map
of %{absolute_path => status_atom}. Also propagates status up to
parent directories so collapsed dirs show the "worst" child status.
This module is pure (no GenServer). The caller is responsible for caching the result and refreshing it on save/git operations.
Summary
Functions
Computes git status for all files under root_path.
Returns the severity rank for a status (higher = more urgent). Used for directory propagation: the "worst" child status wins.
Returns the display symbol for a git status.
Types
@type file_status() ::
:staged | :modified | :untracked | :conflict | :renamed | :deleted
Git status for a single file.
@type status_map() :: %{required(String.t()) => file_status()}
Status map keyed by absolute file path.
Functions
@spec compute(String.t()) :: status_map()
Computes git status for all files under root_path.
Returns a status map with absolute paths as keys. If the path is not inside a git repo, returns an empty map. Directory entries are included with the "worst" status of any descendant.
Runs asynchronously-friendly: no side effects, no process state.
@spec severity(file_status()) :: non_neg_integer()
Returns the severity rank for a status (higher = more urgent). Used for directory propagation: the "worst" child status wins.
@spec symbol(file_status()) :: String.t()
Returns the display symbol for a git status.