source

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package source resolves repository context and compare specifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalDefaultBranch added in v0.3.9

func LocalDefaultBranch(ctx context.Context, r gitexec.GitRunner) (string, error)

LocalDefaultBranch returns the name of the local default branch, preferring "main" over "master". Returns an error if neither local branch exists.

func ResolveRepoContext

func ResolveRepoContext(ctx context.Context, r gitexec.GitRunner) (model.RepoContext, error)

ResolveRepoContext queries git rev-parse to build a RepoContext.

func WorktreeBaseRef added in v0.3.9

func WorktreeBaseRef(ctx context.Context, r gitexec.GitRunner) string

WorktreeBaseRef returns the BaseRef to use for dashboard drill-down diffs: the merge-base of HEAD and the local default branch, so a worktree's diff shows its own changes relative to local trunk rather than @{upstream}. Returns "" when no local default branch exists or merge-base fails, so the caller falls back to the default @{upstream} resolution.

Uses the fully qualified refs/heads/<branch> form for merge-base so a tag of the same name cannot be picked up instead of the local branch.

Types

type BootstrapResult

type BootstrapResult struct {
	Repo   model.RepoContext
	Runner gitexec.GitRunner
}

BootstrapResult holds the resolved repo context and a repo-scoped runner.

func Bootstrap

func Bootstrap(ctx context.Context, cwd string) (BootstrapResult, error)

Bootstrap performs two-phase discovery: creates a runner at cwd to resolve RepoContext, then creates a permanent runner scoped to WorktreeRoot.

type CompareResolver

type CompareResolver struct {
	Runner gitexec.GitRunner
}

CompareResolver resolves a CompareRequest into a ResolvedCompare.

func (*CompareResolver) Resolve

Resolve turns a CompareRequest into a fully-resolved ResolvedCompare.

Jump to

Keyboard shortcuts

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