git

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangedFile

type ChangedFile struct {
	Path   string
	Status FileStatus
	Diff   string // unified diff format
	Binary bool   // true if binary file detected
}

ChangedFile represents a file changed in the working tree vs HEAD.

type FileStatus

type FileStatus int

FileStatus represents the type of change to a file.

const (
	StatusAdded FileStatus = iota
	StatusModified
	StatusDeleted
)

func (FileStatus) String

func (s FileStatus) String() string

type Repo

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

Repo provides read-only access to a git repository.

func Open

func Open(path string) (*Repo, error)

Open opens a git repository at the given path.

func (*Repo) ChangedFiles

func (r *Repo) ChangedFiles() ([]ChangedFile, error)

ChangedFiles returns files changed in the working tree compared to HEAD. It is safe for concurrent use. If go-git's status fails (e.g. due to permission errors on directories), it falls back to system git.

func (*Repo) HeadChanged

func (r *Repo) HeadChanged() (bool, string, error)

HeadChanged checks if HEAD has changed since the last call. Returns whether it changed and the new commit message.

func (*Repo) Path

func (r *Repo) Path() string

Path returns the repository root path.

Jump to

Keyboard shortcuts

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