worktreeadapter

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package worktreeadapter implements configured git repository and worktree operations for the Copilot adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Launcher     proc.ILauncher
	Repositories []copilotadapter.Repository
	WorktreeRoot string
	PatchBytes   int
}

Config declares the only repository roots the browser may select and grants the process capability Git runs through.

type WorktreeManager

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

WorktreeManager is the concrete git/filesystem boundary.

func NewWorktreeManager

func NewWorktreeManager(config Config) (*WorktreeManager, error)

NewWorktreeManager validates repository roots and the managed-worktree root.

func (*WorktreeManager) Changes

func (manager *WorktreeManager) Changes(ctx context.Context, path string) (copilotadapter.WorktreeChanges, error)

Changes returns porcelain file states and a bounded binary-capable patch.

func (*WorktreeManager) Inspect

Inspect returns fresh git metadata or a missing state when the path vanished.

func (*WorktreeManager) Prepare

Prepare validates the ref and creates a managed git worktree by default.

func (*WorktreeManager) Release

func (manager *WorktreeManager) Release(ctx context.Context, worktree copilotadapter.PreparedWorktree) error

Release removes only an adapter-managed path beneath the configured root.

func (*WorktreeManager) Repositories

func (manager *WorktreeManager) Repositories() []copilotadapter.Repository

Repositories returns a defensive copy of configured roots.

func (*WorktreeManager) Reuse

func (manager *WorktreeManager) Reuse(ctx context.Context, repositoryID string, path string) (copilotadapter.PreparedWorktree, error)

Reuse accepts only the configured checkout or a path Git reports as one of that repository's worktrees beneath the managed root. The path comes from server persistence, but legacy rows are deliberately treated as untrusted.

Jump to

Keyboard shortcuts

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