Expand description
Repository state machine — HEAD resolution, branch status, and in-progress operation detection.
§Overview
Git repositories can be in various states beyond just “clean”:
merging, rebasing, cherry-picking, reverting, bisecting, etc.
This module detects those states by checking for sentinel files
(e.g. MERGE_HEAD, rebase-merge/) in the .git directory.
It also resolves HEAD to determine the current branch and commit,
and provides working tree / index diff summaries used by status,
commit, and other porcelain commands.
Structs§
- Repo
State - Full snapshot of a repository’s state.
Enums§
- Head
State - The current state of HEAD.
- InProgress
Operation - An in-progress operation that the repository is in the middle of.
Functions§
- detect_
in_ progress - Detect in-progress operations by checking for sentinel files.
- read_
cherry_ pick_ head - Read CHERRY_PICK_HEAD.
- read_
merge_ heads - Read the MERGE_HEAD file and return the OIDs listed.
- read_
merge_ msg - Read the MERGE_MSG file.
- read_
orig_ head - Read ORIG_HEAD.
- read_
revert_ head - Read REVERT_HEAD.
- repo_
state - Build a complete
RepoStatesnapshot for a repository. - resolve_
head - Resolve HEAD from the given git directory.
- upstream_
tracking - Check upstream (tracking) information for the current branch.