Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalizePath added in v0.7.0

func CanonicalizePath(path string) string

func ExpandPath

func ExpandPath(path string) string

func GenerateWorktreePath

func GenerateWorktreePath(mainRepo, branch string) string

func GetMainRepoFromWorktree

func GetMainRepoFromWorktree(worktreePath string) string

func NewestTreeModTimeContext added in v0.12.0

func NewestTreeModTimeContext(ctx context.Context, path string) (time.Time, error)

func RepositoryCacheKey added in v0.12.0

func RepositoryCacheKey(identity string) string

func SetLogFunc added in v0.10.0

func SetLogFunc(fn func(format string, args ...interface{}))

Types

type BranchInfo

type BranchInfo struct {
	Branch     string
	IsWorktree bool
	MainRepo   string
	Repository string
}

type BranchWithCommit

type BranchWithCommit struct {
	Name       string
	CommitHash string
	CommitTime string
	IsCurrent  bool
}

func (BranchWithCommit) ToProtocol

func (b BranchWithCommit) ToProtocol() protocol.Branch

type Client added in v0.12.0

type Client struct{}

func NewClient added in v0.12.0

func NewClient() *Client

func (*Client) Clone added in v0.12.0

func (c *Client) Clone(ctx context.Context, cloneURL, targetPath string) error

func (*Client) CloneDepthOne added in v0.12.0

func (c *Client) CloneDepthOne(ctx context.Context, source, target string, environment []string) ([]byte, error)

func (*Client) Combined added in v0.12.0

func (c *Client) Combined(ctx context.Context, op Operation, dir string, args ...string) ([]byte, error)

func (*Client) CommitsAhead added in v0.12.0

func (c *Client) CommitsAhead(ctx context.Context, repoDir, base, ref string) (int, error)

func (*Client) CreateBranch added in v0.12.0

func (c *Client) CreateBranch(ctx context.Context, repoDir, branch string) error

func (*Client) CreateWorktreeFromBranch added in v0.12.0

func (c *Client) CreateWorktreeFromBranch(ctx context.Context, repoDir, branch, path string) error

func (*Client) CreateWorktreeFromPoint added in v0.12.0

func (c *Client) CreateWorktreeFromPoint(ctx context.Context, repoDir, branch, path, startingFrom string) error

func (*Client) CreateWorktreeFromRemoteBranch added in v0.12.0

func (c *Client) CreateWorktreeFromRemoteBranch(ctx context.Context, repoDir, remoteBranch, path string) (string, error)

func (*Client) DeleteBranch added in v0.12.0

func (c *Client) DeleteBranch(ctx context.Context, repoDir, branch string, force bool) error

func (*Client) DeleteWorktree added in v0.12.0

func (c *Client) DeleteWorktree(ctx context.Context, repoDir, path string, force bool) error

func (*Client) EnsureAutomationSessionWorktree added in v0.12.0

func (c *Client) EnsureAutomationSessionWorktree(ctx context.Context, repoDir, path, revision, authorization string, sessionPersisted bool) (bool, error)

func (*Client) EnsureDetachedWorktreeAtRevision added in v0.12.0

func (c *Client) EnsureDetachedWorktreeAtRevision(ctx context.Context, repoDir, path, revision string) (bool, error)

func (*Client) EnsureDetachedWorktreeAtRevisionWithHTTPAuthorization added in v0.12.0

func (c *Client) EnsureDetachedWorktreeAtRevisionWithHTTPAuthorization(ctx context.Context, repoDir, path, revision, authorization string) (bool, error)

func (*Client) EnsureManagedClone added in v0.12.0

func (c *Client) EnsureManagedClone(ctx context.Context, cloneURL, target, expectedIdentity, authorization string) (string, bool, error)

func (*Client) EnsurePullRequestRevision added in v0.12.0

func (c *Client) EnsurePullRequestRevision(ctx context.Context, repoDir, remote string, number int, expectedSHA, authorization string) error

func (*Client) EnsureRepo added in v0.12.0

func (c *Client) EnsureRepo(ctx context.Context, cloneURL, targetPath string) (bool, error)

func (*Client) FetchRemoteBranch added in v0.12.0

func (c *Client) FetchRemoteBranch(ctx context.Context, repoDir, remote, branch string) error

func (*Client) FetchRemotes added in v0.12.0

func (c *Client) FetchRemotes(ctx context.Context, repoDir string) error

func (*Client) GetBranchInfo added in v0.12.0

func (c *Client) GetBranchInfo(ctx context.Context, dir string) (*BranchInfo, error)

func (*Client) GetCurrentBranch added in v0.12.0

func (c *Client) GetCurrentBranch(ctx context.Context, repoDir string) (string, error)

func (*Client) GetDefaultBranch added in v0.12.0

func (c *Client) GetDefaultBranch(ctx context.Context, repoDir string) (string, error)

func (*Client) GetHeadCommit added in v0.12.0

func (c *Client) GetHeadCommit(ctx context.Context, dir string) (string, error)

func (*Client) GetHeadCommitInfo added in v0.12.0

func (c *Client) GetHeadCommitInfo(ctx context.Context, repoDir string) (hash string, time string)

func (*Client) GetRepoRoot added in v0.12.0

func (c *Client) GetRepoRoot(ctx context.Context, dir string) (string, error)

func (*Client) IsAncestor added in v0.12.0

func (c *Client) IsAncestor(ctx context.Context, repoDir, commit, base string) (bool, error)

func (*Client) IsWorktreeClean added in v0.12.0

func (c *Client) IsWorktreeClean(ctx context.Context, path string) (bool, error)

func (*Client) LastCommitTime added in v0.12.0

func (c *Client) LastCommitTime(ctx context.Context, dir string) (time.Time, error)

func (*Client) ListBranchesWithCommits added in v0.12.0

func (c *Client) ListBranchesWithCommits(ctx context.Context, repoDir string) ([]BranchWithCommit, error)

func (*Client) ListRemoteBranches added in v0.12.0

func (c *Client) ListRemoteBranches(ctx context.Context, repoDir string) ([]string, error)

func (*Client) ListRemotes added in v0.12.0

func (c *Client) ListRemotes(ctx context.Context, repoDir string) ([]string, error)

func (*Client) ListWorktreeStates added in v0.12.0

func (c *Client) ListWorktreeStates(ctx context.Context, repoDir string) ([]WorktreeState, error)

func (*Client) NoOutput added in v0.12.0

func (c *Client) NoOutput(ctx context.Context, op Operation, dir string, args ...string) error

func (*Client) ObserveLiveWorktrees added in v0.12.0

func (c *Client) ObserveLiveWorktrees(ctx context.Context, repoDir string) ([]WorktreeEntry, error)

func (*Client) ObserveWorktrees added in v0.12.0

func (c *Client) ObserveWorktrees(ctx context.Context, repoDir string) ([]WorktreeEntry, error)

func (*Client) OriginHostOwnerRepo added in v0.12.0

func (c *Client) OriginHostOwnerRepo(ctx context.Context, path string) (host, ownerRepo string, err error)

func (*Client) Output added in v0.12.0

func (c *Client) Output(ctx context.Context, op Operation, dir string, args ...string) ([]byte, error)

func (*Client) OutputWithStdin added in v0.12.0

func (c *Client) OutputWithStdin(ctx context.Context, op Operation, dir string, stdin io.Reader, args ...string) ([]byte, error)

func (*Client) OutputWithTimeout added in v0.12.0

func (c *Client) OutputWithTimeout(ctx context.Context, op Operation, timeout time.Duration, dir string, args ...string) ([]byte, error)

func (*Client) PruneWorktrees added in v0.12.0

func (c *Client) PruneWorktrees(ctx context.Context, repoDir string) error

func (*Client) RefExists added in v0.12.0

func (c *Client) RefExists(ctx context.Context, repoDir, ref string) (bool, error)

func (*Client) RemoteHostOwnerRepos added in v0.12.0

func (c *Client) RemoteHostOwnerRepos(ctx context.Context, dir string) []string

func (*Client) RepositoryRoot added in v0.12.0

func (c *Client) RepositoryRoot(ctx context.Context, dir string) (string, error)

func (*Client) ResolveMainRepoPath added in v0.12.0

func (c *Client) ResolveMainRepoPath(ctx context.Context, repoPath string) string

func (*Client) ResolvePickerRepoTarget added in v0.12.0

func (c *Client) ResolvePickerRepoTarget(ctx context.Context, dir string) (repoRoot string, ok bool, err error)

func (*Client) ResolveRepoDir added in v0.12.0

func (c *Client) ResolveRepoDir(ctx context.Context, repoDir string) (string, error)

func (*Client) StashCountsByBranch added in v0.12.0

func (c *Client) StashCountsByBranch(ctx context.Context, repoDir string) (map[string]int, error)

func (*Client) SwitchBranch added in v0.12.0

func (c *Client) SwitchBranch(ctx context.Context, repoDir, branch string) error

func (*Client) TreeHash added in v0.12.0

func (c *Client) TreeHash(ctx context.Context, repoDir, ref string) (string, error)

func (*Client) TreeHashesOnHistory added in v0.12.0

func (c *Client) TreeHashesOnHistory(ctx context.Context, repoDir, base string) (map[string]bool, error)

func (*Client) ValidateLocalClone added in v0.12.0

func (c *Client) ValidateLocalClone(ctx context.Context, path, expectedIdentity string) (string, error)

func (*Client) WorktreeDirtyCount added in v0.12.0

func (c *Client) WorktreeDirtyCount(ctx context.Context, path string) (int, error)

type Operation added in v0.10.0

type Operation string
const (
	OpMetadata Operation = "metadata"
	OpStatus   Operation = "status"
	OpDiff     Operation = "diff"
	OpWorktree Operation = "worktree"
	OpNetwork  Operation = "network"
	OpClone    Operation = "clone"
)

type WorktreeEntry

type WorktreeEntry struct {
	Path     string
	Branch   string
	Prunable bool
}

type WorktreeState added in v0.12.0

type WorktreeState struct {
	Path     string
	Branch   string
	HeadSHA  string
	Detached bool
	Locked   bool
	Prunable bool
}

Jump to

Keyboard shortcuts

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