git

package
v0.2.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 47 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package git owns bounded repository reads and native Git mutations on Node. Behavioral adaptations retain sailry-code 67ae9fa0, Apache-2.0 provenance.

Index

Constants

View Source
const (
	BranchExists       = "branch already exists"
	BranchInWorktree   = "branch belongs to another worktree"
	DestinationExists  = "destination already exists"
	WorktreeLocked     = "worktree is locked"
	WorktreeDirty      = "worktree has uncommitted changes"
	WorktreePathExists = "worktree path still exists"
)

Messages of the branch and worktree faults that share a code with other causes. A controller compares a fault's message with these to name the cause; any other message keeps the copy of its code.

Variables

This section is empty.

Functions

func CLIArgs

func CLIArgs(action protocol.GitAction, branch, operation string, stashPosition int) ([]string, error)

CLIArgs preserves native argv without executing a shell. Repository-dependent validation and compound operations remain in Action.

func IgnorePattern

func IgnorePattern(path string, directory bool) string

func ParseStatus

func ParseStatus(data []byte, truncated bool) (protocol.GitStatus, error)

ParseStatus reads source-native porcelain v2, including its NUL-framed paths.

func ParseWorktrees

func ParseWorktrees(data []byte, kind protocol.RepositoryKind, truncated bool) (protocol.GitWorktrees, error)

func StatusArgs

func StatusArgs(drivers []string) []string

Types

type CommandResult

type CommandResult struct {
	Stdout, Stderr []byte
	ExitCode       int
	Truncated      bool
	InvalidUTF8    bool
}

type Options

type Options struct {
	Run         Runner
	Now         func() time.Time
	Environment []string
	Profile     string
	// Lock orders run_git_action and create_git_commit with the owner's other
	// effects on a root. The service takes it around their local work and
	// leaves transfers with a remote outside it.
	Lock func(root string) (unlock func())
}

type Runner

type Runner func(context.Context, string, []string, []byte) (CommandResult, error)

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(options Options) *Service

func (*Service) Action

func (*Service) ApplyHunk

ApplyHunk verifies the complete displayed patch before selecting a single working-tree hunk. It shares the same confined files and index publisher as checkpoint review, without claiming a conversation checkpoint identity.

func (*Service) Blame

func (*Service) Branches

func (s *Service) Branches(ctx context.Context, root string) (protocol.GitBranches, error)

func (*Service) CaptureManaged

func (s *Service) CaptureManaged(root string) (string, error)

CaptureManaged returns the source sandbox's protected child-checkout boundary. Repository preparation reuses the single managed/exclude mutation owner.

func (*Service) Change

func (*Service) Changes

func (*Service) Check

func (s *Service) Check(ctx context.Context, root, index string, expectedHead, branch *string) error

func (*Service) Clone

func (s *Service) Clone(ctx context.Context, repositoryURL, destination string, branch *string) (string, error)

func (*Service) Commit

func (s *Service) Commit(ctx context.Context, root, revision string) (protocol.GitCommit, error)

func (*Service) Context

func (*Service) CreateBranch

func (s *Service) CreateBranch(ctx context.Context, root, name, commit string) (protocol.GitBranch, error)

func (*Service) CreateManagedWorktree

func (s *Service) CreateManagedWorktree(ctx context.Context, source, main string, id protocol.WorktreeID, input protocol.CommandCreateManagedWorktreePayload) (string, error)

CreateManagedWorktree copies captured changes into a new owned checkout. The source worktree and index are never modified or stashed.

func (*Service) CreateWorktree

func (s *Service) CreateWorktree(ctx context.Context, root, destination, branch, commit string) (string, error)

func (*Service) DeleteBranch

func (s *Service) DeleteBranch(ctx context.Context, root string, input protocol.CommandDeleteGitBranchPayload) error

func (*Service) Diff

func (s *Service) Diff(ctx context.Context, root, path string, scope protocol.GitDiffScope) (protocol.GitDiff, error)

func (*Service) EditIndex

func (s *Service) EditIndex(ctx context.Context, root, path, expectedIndex string, expectedHead *string, expectedSource string, transform func(string) (string, error)) (protocol.GitIndex, error)

EditIndex transforms the current staged text and compares the observed working file revision again immediately before publishing the detached index candidate.

func (*Service) Execute

func (s *Service) Execute(ctx context.Context, root string, command protocol.Command) (protocol.Output, error)

func (*Service) Head

func (s *Service) Head(ctx context.Context, root string) (protocol.GitHead, error)

func (*Service) Ignore

func (s *Service) Ignore(ctx context.Context, root string, paths []string, directories bool) error

func (*Service) Invalidate

func (s *Service) Invalidate(root string)

func (*Service) ListWorktrees

func (s *Service) ListWorktrees(ctx context.Context, root string) (protocol.GitWorktrees, error)

func (*Service) Log

func (*Service) MergeBranch

func (*Service) NewWatchFilter added in v0.2.7

func (s *Service) NewWatchFilter(ctx context.Context, root string) (*WatchFilter, []string, error)

func (*Service) Output

func (s *Service) Output(root string) string

func (*Service) PrepareManaged

func (s *Service) PrepareManaged(root string) (string, error)

func (*Service) PruneWorktree

func (s *Service) PruneWorktree(ctx context.Context, root, path string) error

func (*Service) Read

func (s *Service) Read(ctx context.Context, root string, command protocol.Command) (protocol.Output, error)

func (*Service) RemoteTags

func (s *Service) RemoteTags(ctx context.Context, root, remote string) ([]protocol.GitTag, error)

func (*Service) RemoveWorktree

func (s *Service) RemoveWorktree(ctx context.Context, root, expectedHead, expectedBranch string) error

func (*Service) RenameBranch

func (s *Service) RenameBranch(ctx context.Context, root, name, newName, commit string) (protocol.GitBranch, error)

func (*Service) Show

func (*Service) Status

func (s *Service) Status(ctx context.Context, root string) (protocol.GitStatus, error)

func (*Service) SwitchBranch

func (*Service) UpdateIndex

type WatchFilter

type WatchFilter struct {
	// contains filtered or unexported fields
}

func NewWatchFilter

func NewWatchFilter(root string) (*WatchFilter, error)

func (*WatchFilter) Changed

func (f *WatchFilter) Changed(paths []string) bool

func (*WatchFilter) ReferencesChanged

func (f *WatchFilter) ReferencesChanged(paths []string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL