git

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommitFormatGithub       = CommitFormat("github")
	CommitFormatConventional = CommitFormat("conventional")
)

Variables

This section is empty.

Functions

func Commit

func Commit(
	ctx context.Context,
	wd string,
	msg io.Reader,
	args ...string,
) error

Commit the changes to the local git repo.

func CommitsBetween

func CommitsBetween(
	ctx context.Context,
	wd string,
	refRange []string,
) (iter.Seq2[string, error], error)

CommitsBetween the provided refRange

This provides an iterator to step through the commits in the range.

refRange is expected to have...

[0] = start
[1] = end

If a single ref is provided, that will be the only commit returned by the iterator.

func DiffsOfCommit

func DiffsOfCommit(
	ctx context.Context,
	wd,
	ref,
	target string,
	dst io.Writer,
) error

DiffsOfCommit writes the git patch of changes made to the target pathspec at the provided ref.

func HeadHash

func HeadHash(ctx context.Context, wd string) (string, error)

HeadHash of the git repo at wd.

func Init

func Init(ctx context.Context, wd string, out io.Writer) error

Init a git repo.

func ListCommitChanges

func ListCommitChanges(ctx context.Context, wd, ref string) (iter.Seq2[string, error], error)

ListCommitChanges provides an iterator to step through the changes to each file committed at ref.

func ListStaged

func ListStaged(ctx context.Context, wd string) (iter.Seq2[string, error], error)

ListStaged provides an iterator to step through each file that currently has staged changes.

func RootCommit

func RootCommit(
	ctx context.Context,
	wd string,
) (string, error)

RootCommit hash of the git repo at wd.

func ShowCommit

func ShowCommit(
	ctx context.Context,
	wd,
	ref string,
	dst io.Writer,
) error

ShowCommit identified by ref at the git repo at wd

stdout will be piped to the dst.

func StagedDiffs

func StagedDiffs(
	ctx context.Context,
	wd,
	target string,
	dst io.Writer,
) error

StagedDiffs writes the staged diffs of target to the dst.

func Status

func Status(
	ctx context.Context,
	wd string,
	target string,
) (iter.Seq2[string, error], string, error)

Status of the target pathspec within the git repo located at the provided wd.

Types

type CommitFormat

type CommitFormat string

Jump to

Keyboard shortcuts

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