Expand description
Git repository utilities for branch tracking
This module provides helper functions for interacting with git repositories to track branch state, detect uncommitted changes, and capture git metadata for branch-aware indexing.
Structs§
- GitState
- Git repository state
- Worktree
Changes - Files that differ between the working tree and the last commit.
Constants§
- MAX_
REPORTED_ PATHS - How many paths per category a
WorktreeChangeswill name.
Functions§
- changed_
paths - Every path
git statuslists, uncapped and unfiltered. - changed_
paths_ in - The paths
git statuslists amongpathspecs(seechanged_paths). Costs what the named paths cost, not what the whole tree costs. - diff_
names - Paths that differ between two commits (
git diff --name-only). - get_
current_ branch - Get the current git branch name
- get_
current_ commit - Get the current commit SHA
- get_
git_ state - Get complete git state for the current repository
- get_
git_ state_ optional - Get git state, or return None if not in a git repository
- get_
worktree_ changes - List working-tree changes against HEAD.
- has_
uncommitted_ changes - Check if there are uncommitted changes in the working tree
- head_
commit_ and_ branch - HEAD’s commit and branch name (
HEADwhen detached), from onegit rev-parse: the same valuesget_current_commitandget_current_branchreturn. - is_
git_ available - Check whether the
gitbinary is available on PATH. - is_
git_ repo - Check if the current directory is inside a git repository
- is_
ignored - Whether
git check-ignoresayspath(workspace-relative) is ignored. - read_
head_ branch - The current branch, read from
.git/HEADwithout spawninggit.