Read and change an explicit Git repository. Operations that invoke Git belong in an extension worker, not an editor callback. Editor buffer tracking and repository processes are private to the host.
Summary
Types
One contiguous change with zero-based coordinates in the base and revised text.
Accepted diff options. Unknown keys, duplicate keys, and invalid values are rejected. :commit may be combined with :staged, but only when :staged is false.
A structured log entry.
A structured stash entry.
A structured status entry for one file.
Accepted status/2 options.
How much untracked-file detail git status should enumerate.
Functions
Finds the change at a buffer line, including the anchor above a deletion.
Reads a regular file's stage-zero blob, returning {:ok, nil} for an absent
path, {:ok, ""} for an empty blob, and {:error, reason} for an unmerged
path or a read failure.
Reads recent commits with :count, :path, :skip, and a full :revision object ID.
Returns the next or previous change's buffer line, or nil if there is none.
Requests a status refresh if Minga already tracks this repository.
Reverts just one change in the revised text, without editing or saving a buffer.
Stages only the selected change without modifying the worktree.
Captures tracked-buffer text, cursor, version, and changes against cached HEAD.
Types
@type change() :: MingaEditor.Extension.GitDiff.Hunk.change()
One contiguous change with zero-based coordinates in the base and revised text.
Accepted diff options. Unknown keys, duplicate keys, and invalid values are rejected. :commit may be combined with :staged, but only when :staged is false.
@type diff_opts() :: [diff_opt()]
@type log_entry() :: Minga.Git.LogEntry.t()
A structured log entry.
@type stash_entry() :: Minga.Git.StashEntry.t()
A structured stash entry.
@type status_entry() :: Minga.Git.StatusEntry.t()
A structured status entry for one file.
@type status_opt() :: {:untracked_mode, untracked_mode()} | {:timeout_ms, pos_integer()}
Accepted status/2 options.
@type status_opts() :: [status_opt()]
@type untracked_mode() :: :no | :normal | :all
How much untracked-file detail git status should enumerate.
Functions
@spec ahead_behind(String.t()) :: {:ok, non_neg_integer(), non_neg_integer()} | :error
@spec blame_line(String.t(), String.t(), non_neg_integer()) :: {:ok, String.t()} | :error
@spec branch_list(String.t()) :: {:ok, [Minga.Git.BranchInfo.t()]} | {:error, String.t()}
@spec change_at([change()], non_neg_integer()) :: change() | nil
Finds the change at a buffer line, including the anchor above a deletion.
Reads a regular file's stage-zero blob, returning {:ok, nil} for an absent
path, {:ok, ""} for an empty blob, and {:error, reason} for an unmerged
path or a read failure.
Reads recent commits with :count, :path, :skip, and a full :revision object ID.
@spec neighbor_change_line([change()], non_neg_integer(), :next | :previous) :: non_neg_integer() | nil
Returns the next or previous change's buffer line, or nil if there is none.
@spec refresh_status(String.t()) :: :ok
Requests a status refresh if Minga already tracks this repository.
Reverts just one change in the revised text, without editing or saving a buffer.
@spec stage_change(String.t(), String.t(), binary() | nil, binary() | nil, change()) :: :ok | {:error, String.t()}
Stages only the selected change without modifying the worktree.
Use nil for an absent file and "" for a present empty file in either
snapshot. A mismatch in index presence or a conflicting edit at the selected
hunk is rejected. Unrelated staged changes are preserved.
@spec stash_drop(String.t(), non_neg_integer()) :: :ok | {:error, String.t()}
@spec stash_list(String.t()) :: {:ok, [stash_entry()]} | {:error, String.t()}
@spec status(String.t(), status_opts()) :: {:ok, [status_entry()]} | {:error, String.t()}
@spec tracked_file(pid()) :: {:ok, Minga.Git.TrackedFile.t()} | :not_tracked
Captures tracked-buffer text, cursor, version, and changes against cached HEAD.