patcher

package
v0.0.0-...-da3a13a Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnumerateTree

func EnumerateTree(ctx context.Context, r *gitutil.Runner, repoDir, commit string) (map[string]PathMeta, error)

EnumerateTree returns all file paths tracked at the given commit, along with object metadata. Returned paths are repo-relative and match the output of `git ls-tree -r --name-only`.

func FilterNonIgnoredPaths

func FilterNonIgnoredPaths(ctx context.Context, r *gitutil.Runner, templateDir string, candidatePaths []string) ([]string, error)

FilterNonIgnoredPaths returns only the paths that are NOT ignored by the template repo's ignore rules as of the template repo's current state (i.e. patterns from .gitignore at HEAD).

func FindBaselineRootCommit

func FindBaselineRootCommit(ctx context.Context, r *gitutil.Runner, activeDir string) (string, error)

func Run

func Run(ctx context.Context, opts RunOptions) error

Types

type DefaultBranch

type DefaultBranch struct {
	Ref     string // e.g. refs/remotes/origin/main or refs/heads/main or HEAD
	Commit  string
	Display string // short display name for audit
}

func FindDefaultBranchTip

func FindDefaultBranchTip(ctx context.Context, r *gitutil.Runner, activeDir string) (DefaultBranch, error)

type Feedback

type Feedback interface {
	StepStart(stepID string)
	StepDone(stepID string)
	StepError(stepID string, err error)
	ProgressInit(stepID string, total int)
	ProgressAdvance(stepID string, delta int)
	FinalMessage(message string)
	Close() error
}

type PatchRepoResult

type PatchRepoResult struct {
	PatchRepoDir string
	BaselineOID  string
	TemplateOID  string
	PatchPath    string
}

func CreatePatchRepoAndGeneratePatch

func CreatePatchRepoAndGeneratePatch(
	ctx context.Context,
	r *gitutil.Runner,
	feedback Feedback,
	workdirParent string,
	keepWorkdir bool,
	activeDir string,
	templateDir string,
	baselineCommit string,
	templateLatestCommit string,
	includedPaths []string,
	baselineEntries map[string]PathMeta,
	templateEntries map[string]PathMeta,
	audit *gitutil.AuditLogger,
) (*PatchRepoResult, error)

type PathMeta

type PathMeta struct {
	ObjectMode string // e.g. 100644, 100755, 120000
	Type       string // e.g. blob
}

type RunOptions

type RunOptions struct {
	TemplateInput string
	ActiveProject string
	Workdir       string
	BranchPrefix  string
	KeepWorkdir   bool
}

Jump to

Keyboard shortcuts

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