bisect

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package bisect wraps git bisect to automatically identify the commit that introduced a regression. It runs a user-supplied check function across a commit range and returns the offending commit with its diff.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bisect

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

Bisect wraps git bisect operations.

func New

func New(workDir string, logger *slog.Logger) *Bisect

New creates a Bisect instance backed by the project's git wrapper. If git is nil, a minimal exec-based fallback is used (kept for backward compatibility with callers that don't wire the wrapper).

func (*Bisect) Run

func (b *Bisect) Run(sessionStartHash, headHash string, checkFn func() bool) (result *BisectResult, err error)

Run performs a git bisect between sessionStartHash (good) and headHash (bad) using checkFn to determine pass/fail at each step. checkFn returns true if the commit passes verification, false if it fails. On git bisect reset failure, returns an error wrapping ErrBisectResetFailed (M-29).

func (*Bisect) SetGit

func (b *Bisect) SetGit(g GitRunner)

SetGit wires the project's git wrapper into the bisect instance.

type BisectResult

type BisectResult struct {
	OffendingCommit git.CommitInfo
	Diff            string
}

BisectResult holds the offending commit and its diff.

type GitRunner

type GitRunner interface {
	Run(args ...string) (string, error)
}

GitRunner is the subset of *git.Git that Bisect uses. Using an interface lets callers inject test doubles without pulling in the full git wrapper.

Jump to

Keyboard shortcuts

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