Documentation
¶
Overview ¶
Package split implements logic for branch split commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchRequest ¶
type BranchRequest struct { Branch string // required Options *Options // optional, defaults to nil // SelectCommits is a function that allows the user to select commits // for splitting the branch if the --at flag is not provided. SelectCommits func(context.Context, []git.CommitDetail) ([]Point, error) }
BranchRequest is a request to split a branch.
type GitRepository ¶
type GitRepository interface { CreateBranch(ctx context.Context, req git.CreateBranchRequest) error BranchExists(ctx context.Context, branch string) bool PeelToCommit(ctx context.Context, ref string) (git.Hash, error) SetBranchUpstream(ctx context.Context, branch, upstream string) error BranchUpstream(ctx context.Context, branch string) (string, error) ListCommitsDetails(ctx context.Context, commits git.CommitRange) iter.Seq2[git.CommitDetail, error] }
GitRepository provides treeless read/write access to the Git state.
type Handler ¶
type Handler struct { Log *silog.Logger // required View ui.View // required Repository GitRepository // required Store Store // required Service Service // required FindForge func(forgeID string) (forge.Forge, bool) // required HighlightStyle lipgloss.Style // required }
Handler handles gs's branch split commands.
func (*Handler) SplitBranch ¶
func (h *Handler) SplitBranch(ctx context.Context, req *BranchRequest) error
SplitBranch splits a branch into two or more branches along commit boundaries.
type Options ¶
type Options struct {
At []Point `placeholder:"COMMIT:NAME" help:"Commits to split the branch at."`
}
Options defines options for the SplitBranch method. These are exposed as flags in the CLI
type Point ¶
type Point struct { // Commit is the git commit hash to split at. Commit string // Name is the name of the new branch to create at the commit. Name string }
Point represents a commit:name pair for splitting.
Click to show internal directories.
Click to hide internal directories.