delete

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package delete implements support for branch deletion with git-spice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitRepository

type GitRepository interface {
	PeelToCommit(ctx context.Context, ref string) (git.Hash, error)
	LocalBranches(ctx context.Context, opts *git.LocalBranchesOptions) iter.Seq2[git.LocalBranch, error]
	IsAncestor(ctx context.Context, a, b git.Hash) bool
	DeleteBranch(ctx context.Context, branch string, opts git.BranchDeleteOptions) error
	BranchExists(ctx context.Context, branch string) bool
}

GitRepository provides access to tree-less operations on a Git repository.

type GitWorktree

type GitWorktree interface {
	CurrentBranch(ctx context.Context) (string, error)
	Checkout(ctx context.Context, branch string) error
	DetachHead(ctx context.Context, commit string) error
}

GitWorktree is a checkout of a Git repository.

type Handler

type Handler struct {
	Log        *silog.Logger // required
	View       ui.View       // required
	Repository GitRepository // required
	Worktree   GitWorktree   // required
	Store      Store         // required
	Service    Service       // required
}

Handler implements support for branch deletion with git-spice.

func (*Handler) DeleteBranches

func (h *Handler) DeleteBranches(ctx context.Context, req *Request) error

DeleteBranches deletes the specified branches from the repository, updating all internal state as necessary.

type Request

type Request struct {
	Branches []string
	Force    bool
}

Request is a request to delete one or more branches.

type Service

type Service interface {
	LookupBranch(ctx context.Context, name string) (*spice.LookupBranchResponse, error)
	ListAbove(ctx context.Context, branch string) ([]string, error)
	BranchOnto(ctx context.Context, req *spice.BranchOntoRequest) error
	RebaseRescue(ctx context.Context, req spice.RebaseRescueRequest) error
}

Service provides access to spice.Service methods

type Store

type Store interface {
	Trunk() string
	BeginBranchTx() *state.BranchTx
}

Store provides access to the state store.

Jump to

Keyboard shortcuts

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