git

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package git provides functions for determining changes in a git repository.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrGitStatusUnclean reported when the git status reports uncommitted
	// changes.
	ErrGitStatusUnclean = errors.New("git working directory is not clean")
)

Functions

func AssertGitStatusClean

func AssertGitStatusClean(ctx context.Context, git string) error

AssertGitStatusClean returns an error if the git working directory has uncommitted changes.

func CheckRemoteURL

func CheckRemoteURL(ctx context.Context, gitExe, remote string) error

CheckRemoteURL checks that the git remote URL exists.

func CheckVersion

func CheckVersion(ctx context.Context, gitExe string) error

CheckVersion checks that the git version command can run.

func FilesChangedSince

func FilesChangedSince(ctx context.Context, ref, gitExe string, ignoredChanges []string) ([]string, error)

FilesChangedSince returns the files changed since the given git ref.

func FindCommitsForPath

func FindCommitsForPath(ctx context.Context, gitExe, path string) ([]string, error)

FindCommitsForPath returns the full hashes of all commits affecting the given path. The commits are returned in normal log order, i.e. latest commit first.

func GetLastTag

func GetLastTag(ctx context.Context, gitExe, remote, branch string) (string, error)

GetLastTag returns the last git tag for the given release configuration.

func IsNewFile

func IsNewFile(ctx context.Context, gitExe, ref, name string) bool

IsNewFile returns true if the given file is new since the given git ref.

func MatchesBranchPoint

func MatchesBranchPoint(ctx context.Context, gitExe, remote, branch string) error

MatchesBranchPoint returns an error if the local repository has unpushed changes.

func ShowFileAtRemoteBranch

func ShowFileAtRemoteBranch(ctx context.Context, gitExe, remote, branch, path string) (string, error)

ShowFileAtRemoteBranch shows the contents of the file found at the given path on the given remote/branch.

func ShowFileAtRevision

func ShowFileAtRevision(ctx context.Context, gitExe, revision, path string) (string, error)

ShowFileAtRevision shows the contents of the file found at the given path at the given revision (which can be a tag, a commit, a remote/branch etc).

Types

This section is empty.

Jump to

Keyboard shortcuts

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