Skip to main content

Module git

Module git 

Source
Expand description

Git plumbing.

magi drives the git CLI rather than linking a library: every operation it needs is a one-liner, and shelling out keeps the behaviour identical to what the operator sees when they inspect a run by hand.

Structs§

GitOut
Output of a completed git invocation.

Functions§

branch_delete
Delete a branch, ignoring “not found”.
branch_exists
Does branch exist?
changed_files
Number of files touched by base...head.
commit_all
Stage everything and commit under a neutral identity.
commits_ahead
How many commits head is ahead of base.
current_branch
Currently checked-out branch, or None when detached.
diff
Patch of head against the merge base with base.
diff_stat
--stat summary of base...head.
disable_worktree_config
Undo enable_worktree_config.
enable_worktree_config
Enable extensions.worktreeConfig if it is not already on.
fetch
Fetch one branch from remote, updating its remote-tracking ref.
git
Run git, failing on a non-zero exit status.
git_raw
Run git in cwd with args, returning the captured output regardless of exit status.
is_clean
Is the working tree free of tracked modifications and untracked files?
local_exclude
Exclude a path from a worktree’s status without touching .gitignore.
log_oneline
One-line log of base..head, oldest first.
merge_no_ff
git merge --no-ff of branch into the currently checked-out branch.
push
Push a branch to remote.
push_rewritten
Force-push a branch that has been rewritten, refusing to clobber work pushed since this side last looked.
rebase_branch_in_temp
Rebase a branch onto onto, inside a throwaway worktree.
remove_worktree_from_linked
Unregister a linked worktree whose directory is about to be deleted by hand, so the path can be worktree add-ed again.
reset_detached
Move an existing detached worktree to rev, discarding local state.
rev_exists
Does this ref resolve?
rev_parse
Resolve a revision to a full object id.
set_worktree_hooks_path
Point a single worktree at its own hooks directory.
status_porcelain
git status --porcelain, for reporting what is dirty.
toplevel
Absolute path to the top level of the working tree containing path.
worktree_add_branch
Create a worktree at path with a fresh branch branch starting at base.
worktree_add_detached
Create a worktree at path with a detached HEAD at rev.
worktree_remove
Remove a worktree. Returns Ok(false) when git refused (e.g. the path is already gone), so callers can keep folding the rest of a run.