igit

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package igit provides interoperability with Git.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CI added in v0.2.0

type CI struct {
	// BaselineStatus is used to check against when running CI checks, so that each CI task can
	// see if it introduced changes.
	BaselineStatus Status
	// CurrentStatus is the latest-available Git status, which may differ from the baseline.
	CurrentStatus Status
}

CI defines metadata & behavior for CI tasks.

func NewForCI added in v0.2.0

func NewForCI(ctx context.Context) (*CI, error)

NewForCI returns Git information for CI tasks.

func (*CI) StatusHasChanged added in v0.2.0

func (g *CI) StatusHasChanged(ctx context.Context) (bool, error)

StatusHasChanged informs the caller of whether or not the Status now differs from the baseline.

func (*CI) Update added in v0.2.0

func (g *CI) Update(ctx context.Context) error

Update recalculates various Git metadata, respecting any existing baseline values set in NewForCI.

type Git

type Git struct {
	// The root directory of the repository on the host.
	Root string
	// The current branch name.
	Branch string
	// The latest tag available in the repo.
	LatestTag string
	// The latest commit on the current branch.
	LatestCommit string
	// Whether or not the working directory has uncommitted changes.
	IsDirty bool
}

Git holds metadata about the current state of the Git repository.

func New

func New(ctx context.Context) (*Git, error)

New returns a populated Git.

func (*Git) SanitizedBranch added in v0.2.0

func (g *Git) SanitizedBranch() string

SanitizedBranch returns the current branch name, sanitized for various systems that allow for a smaller charset (e.g. container image tags).

func (*Git) String added in v0.2.0

func (g *Git) String() string

String implements fmt.Stringer.

type Status

type Status struct {
	// The list of modified files.
	Diff []string
	// The list of untracked files.
	UntrackedFiles []string
}

Status holds various pieces of information about Git status.

Jump to

Keyboard shortcuts

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