git

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package git provides utilities for interacting with git repositories.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidGitRef indicates a git ref contains unexpected characters.
	ErrInvalidGitRef = errors.New("invalid git ref")
)

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Hash     string `yaml:"commit"`
	Parent   string `yaml:"parent"`
	Refs     string `yaml:"refs"`
	Subject  string `yaml:"subject"`
	Author   Person `yaml:"author"`
	Commiter Person `yaml:"commiter"`
}

Commit represents a single git commit.

type Git

type Git struct {
	Log *zerolog.Logger
}

Git wraps git CLI operations.

func (*Git) FindGitRepositoryRoot

func (g *Git) FindGitRepositoryRoot(ctx context.Context) (string, error)

FindGitRepositoryRoot returns the absolute path to the root of the git repository.

func (*Git) GetAllCommits

func (g *Git) GetAllCommits(ctx context.Context, chartPath string) ([]Commit, error)

GetAllCommits returns all git commits affecting the given chart path.

func (*Git) GetDiffBetweenCommits

func (g *Git) GetDiffBetweenCommits(ctx context.Context, start, end, diffPath string) (string, error)

GetDiffBetweenCommits returns the diff of a file between two commits.

func (*Git) GetFileContent

func (g *Git) GetFileContent(ctx context.Context, hash, filePath string) (string, error)

GetFileContent returns the content of a file at a specific git revision.

type Person

type Person struct {
	Name  string     `yaml:"name"`
	Email string     `yaml:"email"`
	Date  *time.Time `yaml:"date"`
}

Person represents a git actor (author or committer).

Jump to

Keyboard shortcuts

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