Skip to main content

Module state

Module state 

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

RepoState
Full snapshot of a repository’s state.

Enums§

HeadState
The current state of HEAD.
InProgressOperation
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 RepoState snapshot for a repository.
resolve_head
Resolve HEAD from the given git directory.
upstream_tracking
Check upstream (tracking) information for the current branch.