git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupported = errors.New("git: operation not supported on this backend")
	ErrNotARepo    = errors.New("git: not inside a git repository")
	ErrNoGitCLI    = errors.New("git: `git` binary not on PATH and go-git fallback unavailable")
)

Functions

func FindRepo

func FindRepo(start string) (string, error)

Types

type CLIRepo

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

func NewCLIRepo

func NewCLIRepo(root string) (*CLIRepo, error)

func (*CLIRepo) BranchDiff

func (r *CLIRepo) BranchDiff(target string) (Diff, error)

func (*CLIRepo) CommitDiff

func (r *CLIRepo) CommitDiff(hash string) (Diff, error)

func (*CLIRepo) FileDiff

func (r *CLIRepo) FileDiff(path string) (Diff, error)

func (*CLIRepo) RangeDiff

func (r *CLIRepo) RangeDiff(target, feature string) (Diff, error)

func (*CLIRepo) Root

func (r *CLIRepo) Root() string

func (*CLIRepo) StagedDiff

func (r *CLIRepo) StagedDiff() (Diff, error)

func (*CLIRepo) UnstagedDiff

func (r *CLIRepo) UnstagedDiff() (Diff, error)

type Diff

type Diff struct {
	Content string
	Origin  Origin
	Args    map[string]string
}

func (Diff) Empty

func (d Diff) Empty() bool

type DispatchOptions

type DispatchOptions struct {
	Logger *slog.Logger
}

type DispatchRepo

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

func Open

func Open(root string, opts DispatchOptions) (*DispatchRepo, error)

func (*DispatchRepo) BranchDiff

func (d *DispatchRepo) BranchDiff(target string) (Diff, error)

func (*DispatchRepo) CommitDiff

func (d *DispatchRepo) CommitDiff(hash string) (Diff, error)

func (*DispatchRepo) FileDiff

func (d *DispatchRepo) FileDiff(path string) (Diff, error)

func (*DispatchRepo) RangeDiff

func (d *DispatchRepo) RangeDiff(target, feature string) (Diff, error)

func (*DispatchRepo) Root

func (d *DispatchRepo) Root() string

func (*DispatchRepo) StagedDiff

func (d *DispatchRepo) StagedDiff() (Diff, error)

func (*DispatchRepo) UnstagedDiff

func (d *DispatchRepo) UnstagedDiff() (Diff, error)

type GoGitRepo

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

func NewGoGitRepo

func NewGoGitRepo(root string) (*GoGitRepo, error)

func (*GoGitRepo) BranchDiff

func (g *GoGitRepo) BranchDiff(target string) (Diff, error)

func (*GoGitRepo) CommitDiff

func (g *GoGitRepo) CommitDiff(hash string) (Diff, error)

func (*GoGitRepo) FileDiff

func (g *GoGitRepo) FileDiff(string) (Diff, error)

func (*GoGitRepo) RangeDiff

func (g *GoGitRepo) RangeDiff(target, feature string) (Diff, error)

func (*GoGitRepo) Root

func (g *GoGitRepo) Root() string

func (*GoGitRepo) StagedDiff

func (g *GoGitRepo) StagedDiff() (Diff, error)

func (*GoGitRepo) UnstagedDiff

func (g *GoGitRepo) UnstagedDiff() (Diff, error)

type Origin

type Origin string
const (
	OriginStaged   Origin = "staged"
	OriginUnstaged Origin = "unstaged"
	OriginFile     Origin = "file"
	OriginCommit   Origin = "commit"
	OriginRange    Origin = "range"
	OriginBranch   Origin = "branch"
)

type Repo

type Repo interface {
	StagedDiff() (Diff, error)
	UnstagedDiff() (Diff, error)
	FileDiff(path string) (Diff, error)
	CommitDiff(hash string) (Diff, error)
	RangeDiff(target, feature string) (Diff, error)
	BranchDiff(target string) (Diff, error)
	Root() string
}

Jump to

Keyboard shortcuts

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