Documentation
¶
Overview ¶
Package gitcommit provides the host-owned Git transaction used by native commit workflows. It deliberately has no UI or HTTP dependencies.
Index ¶
- func FingerprintsEqual(a, b Fingerprint) bool
- func IsKind(err error, kind ErrorKind) bool
- func ValidateSelectionPaths(state RepositoryState, paths []string) error
- type Change
- type ChangeKind
- type CommitResult
- type DiffSummary
- type Error
- type ErrorKind
- type Fingerprint
- type HeadState
- type MutationCoordinator
- type OperationFingerprint
- type OperationKind
- type OperationState
- type Repository
- func (r *Repository) CheckoutID() string
- func (r *Repository) CheckoutRoot() string
- func (r *Repository) Commit(ctx context.Context, message string, expected Fingerprint) (CommitResult, error)
- func (r *Repository) DraftContext(ctx context.Context, expected Fingerprint) (string, error)
- func (r *Repository) Inspect(ctx context.Context) (RepositoryState, error)
- func (r *Repository) ScopeContext(ctx context.Context, expected Fingerprint, statusToken string) (string, error)
- func (r *Repository) SetCoordinator(c MutationCoordinator)
- func (r *Repository) Stage(ctx context.Context, request StageRequest, expected Fingerprint) (RepositoryState, error)
- type RepositoryState
- type StageMode
- type StageRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FingerprintsEqual ¶
func FingerprintsEqual(a, b Fingerprint) bool
func ValidateSelectionPaths ¶
func ValidateSelectionPaths(state RepositoryState, paths []string) error
ValidateSelectionPaths validates model/user paths without mutating the index.
Types ¶
type Change ¶
type Change struct {
Path string `json:"path"`
OldPath string `json:"old_path,omitempty"`
Kind ChangeKind `json:"kind"`
Staged bool `json:"staged,omitempty"`
Unstaged bool `json:"unstaged,omitempty"`
Untracked bool `json:"untracked,omitempty"`
PartiallyStaged bool `json:"partially_staged,omitempty"`
Submodule bool `json:"submodule,omitempty"`
Additions int `json:"additions,omitempty"`
Deletions int `json:"deletions,omitempty"`
Binary bool `json:"binary,omitempty"`
}
type ChangeKind ¶
type ChangeKind string
const ( ChangeModified ChangeKind = "modified" ChangeAdded ChangeKind = "added" ChangeDeleted ChangeKind = "deleted" ChangeRenamed ChangeKind = "renamed" ChangeCopied ChangeKind = "copied" ChangeTypeChanged ChangeKind = "type_changed" ChangeUntracked ChangeKind = "untracked" ChangeConflicted ChangeKind = "conflicted" )
type CommitResult ¶
type CommitResult struct {
BeforeHead string `json:"before_head,omitempty"`
HeadOID string `json:"head_oid"`
TreeOID string `json:"tree_oid"`
ShortOID string `json:"short_oid"`
Subject string `json:"subject"`
Message string `json:"message"`
TreeChanged bool `json:"tree_changed"`
OutcomeUncertain bool `json:"outcome_uncertain"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
}
type DiffSummary ¶
type Error ¶
type ErrorKind ¶
type ErrorKind string
const ( ErrGitMissing ErrorKind = "git_missing" ErrNotRepository ErrorKind = "not_repository" ErrBareRepository ErrorKind = "bare_repository" ErrUnsafeRepository ErrorKind = "unsafe_repository" ErrConflict ErrorKind = "conflict" ErrUnsupportedOperation ErrorKind = "unsupported_operation" ErrIntentToAdd ErrorKind = "intent_to_add" ErrEmptyIndex ErrorKind = "empty_index" ErrStale ErrorKind = "stale" ErrInvalidSelection ErrorKind = "invalid_selection" ErrIndexLock ErrorKind = "index_lock" ErrMissingIdentity ErrorKind = "missing_identity" ErrHook ErrorKind = "hook_failure" ErrSigning ErrorKind = "signing_failure" ErrCommit ErrorKind = "commit_failure" ErrUncertain ErrorKind = "uncertain_outcome" ErrOutputLimit ErrorKind = "output_limit" )
type Fingerprint ¶
type Fingerprint struct {
CheckoutID string `json:"checkout_id"`
HeadState HeadState `json:"head_state"`
HeadOID string `json:"head_oid,omitempty"`
IndexTree string `json:"index_tree"`
Operation OperationFingerprint `json:"operation"`
}
type MutationCoordinator ¶
type OperationFingerprint ¶
type OperationFingerprint struct {
Kind OperationKind `json:"kind"`
HeadOIDs []string `json:"head_oids"`
Digest string `json:"digest"`
}
type OperationKind ¶
type OperationKind string
const ( OperationNone OperationKind = "none" OperationMerge OperationKind = "merge" OperationCherryPick OperationKind = "cherry_pick" OperationRevert OperationKind = "revert" OperationRebase OperationKind = "rebase" OperationSequencer OperationKind = "sequencer" )
type OperationState ¶
type OperationState struct {
Kind OperationKind `json:"kind"`
Description string `json:"description,omitempty"`
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func OpenWithCoordinator ¶
func OpenWithCoordinator(ctx context.Context, dir string, coordinator MutationCoordinator) (*Repository, error)
func (*Repository) CheckoutID ¶
func (r *Repository) CheckoutID() string
func (*Repository) CheckoutRoot ¶
func (r *Repository) CheckoutRoot() string
func (*Repository) Commit ¶
func (r *Repository) Commit(ctx context.Context, message string, expected Fingerprint) (CommitResult, error)
func (*Repository) DraftContext ¶
func (r *Repository) DraftContext(ctx context.Context, expected Fingerprint) (string, error)
DraftContext returns only finalized staged changes and recent subjects.
func (*Repository) Inspect ¶
func (r *Repository) Inspect(ctx context.Context) (RepositoryState, error)
func (*Repository) ScopeContext ¶
func (r *Repository) ScopeContext(ctx context.Context, expected Fingerprint, statusToken string) (string, error)
ScopeContext returns bounded, read-only context for whole-file scope planning. The caller must still revalidate the status token before applying a proposal.
func (*Repository) SetCoordinator ¶
func (r *Repository) SetCoordinator(c MutationCoordinator)
func (*Repository) Stage ¶
func (r *Repository) Stage(ctx context.Context, request StageRequest, expected Fingerprint) (RepositoryState, error)
type RepositoryState ¶
type RepositoryState struct {
CheckoutRoot string `json:"-"`
GitDirID string `json:"git_dir_id"`
Branch string `json:"branch,omitempty"`
Detached bool `json:"detached"`
Unborn bool `json:"unborn"`
HeadOID string `json:"head_oid,omitempty"`
Operation OperationState `json:"operation"`
Staged []Change `json:"staged"`
Unstaged []Change `json:"unstaged"`
Untracked []Change `json:"untracked"`
Conflicted []Change `json:"conflicted"`
Summary DiffSummary `json:"summary"`
Fingerprint Fingerprint `json:"fingerprint"`
StatusToken string `json:"status_token,omitempty"`
SelectionAvailable bool `json:"selection_available"`
Truncated bool `json:"truncated"`
TotalStaged int `json:"total_staged"`
TotalUnstaged int `json:"total_unstaged"`
TotalUntracked int `json:"total_untracked"`
}
type StageRequest ¶
Click to show internal directories.
Click to hide internal directories.