git

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWorktreeNotFound = errors.New("worktree not found")

ErrWorktreeNotFound indicates a worktree entry was missing.

Functions

func EnsureSSHAuthSock added in v0.3.0

func EnsureSSHAuthSock()

EnsureSSHAuthSock maps ssh IdentityAgent to SSH_AUTH_SOCK when available.

Types

type CLIClient added in v0.3.0

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

CLIClient implements Git operations via the git CLI.

func NewCLIClient added in v0.3.0

func NewCLIClient() CLIClient

NewCLIClient constructs a git CLI client.

func (CLIClient) AddRemote added in v0.3.0

func (c CLIClient) AddRemote(path, name, url string) error

func (CLIClient) Clone added in v0.3.0

func (c CLIClient) Clone(ctx context.Context, url, path, remoteName string) error

func (CLIClient) CloneBare added in v0.3.0

func (c CLIClient) CloneBare(ctx context.Context, url, path, remoteName string) error

func (CLIClient) CurrentBranch added in v0.3.0

func (c CLIClient) CurrentBranch(repoPath string) (string, bool, error)

func (CLIClient) Fetch added in v0.3.0

func (c CLIClient) Fetch(ctx context.Context, repoPath, remoteName string) error

func (CLIClient) IsAncestor added in v0.3.0

func (c CLIClient) IsAncestor(repoPath, ancestorRef, descendantRef string) (bool, error)

func (CLIClient) IsContentMerged added in v0.3.0

func (c CLIClient) IsContentMerged(repoPath, branchRef, baseRef string) (bool, error)

func (CLIClient) IsRepo added in v0.3.0

func (c CLIClient) IsRepo(path string) (bool, error)

func (CLIClient) ReferenceExists added in v0.3.0

func (c CLIClient) ReferenceExists(ctx context.Context, repoPath, ref string) (bool, error)

func (CLIClient) RemoteExists added in v0.3.0

func (c CLIClient) RemoteExists(repoPath, remoteName string) (bool, error)

func (CLIClient) RemoteNames added in v0.3.0

func (c CLIClient) RemoteNames(repoPath string) ([]string, error)

func (CLIClient) RemoteURLs added in v0.3.0

func (c CLIClient) RemoteURLs(repoPath, remoteName string) ([]string, error)

func (CLIClient) Status added in v0.3.0

func (c CLIClient) Status(path string) (StatusSummary, error)

func (CLIClient) UpdateBranch added in v0.3.0

func (c CLIClient) UpdateBranch(ctx context.Context, repoPath, branchName, targetRef string) error

UpdateBranch force-updates branchName to targetRef. Callers must ensure the update is safe.

func (CLIClient) WorktreeAdd added in v0.3.0

func (c CLIClient) WorktreeAdd(ctx context.Context, opts WorktreeAddOptions) error

func (CLIClient) WorktreeList added in v0.3.0

func (c CLIClient) WorktreeList(repoPath string) ([]string, error)

func (CLIClient) WorktreeRemove added in v0.3.0

func (c CLIClient) WorktreeRemove(opts WorktreeRemoveOptions) error

type Client

type Client interface {
	Clone(ctx context.Context, url, path, remoteName string) error
	CloneBare(ctx context.Context, url, path, remoteName string) error
	AddRemote(path, name, url string) error
	RemoteNames(repoPath string) ([]string, error)
	RemoteURLs(repoPath, remoteName string) ([]string, error)
	ReferenceExists(ctx context.Context, repoPath, ref string) (bool, error)
	Fetch(ctx context.Context, repoPath, remoteName string) error
	// UpdateBranch force-updates branchName to targetRef. Callers must ensure the update is safe.
	UpdateBranch(ctx context.Context, repoPath, branchName, targetRef string) error
	Status(path string) (StatusSummary, error)
	IsRepo(path string) (bool, error)
	IsAncestor(repoPath, ancestorRef, descendantRef string) (bool, error)
	IsContentMerged(repoPath, branchRef, baseRef string) (bool, error)
	CurrentBranch(repoPath string) (string, bool, error)
	RemoteExists(repoPath, remoteName string) (bool, error)
	WorktreeAdd(ctx context.Context, opts WorktreeAddOptions) error
	WorktreeRemove(opts WorktreeRemoveOptions) error
	WorktreeList(repoPath string) ([]string, error)
}

type StatusSummary

type StatusSummary struct {
	Dirty   bool
	Missing bool
}

type WorktreeAddOptions

type WorktreeAddOptions struct {
	RepoPath      string
	WorktreePath  string
	WorktreeName  string
	BranchName    string
	StartRemote   string
	StartBranch   string
	ForceCheckout bool
}

type WorktreeRemoveOptions added in v0.3.0

type WorktreeRemoveOptions struct {
	RepoPath     string
	WorktreeName string
	Force        bool
}

Jump to

Keyboard shortcuts

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