git

package
v0.0.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorInfo

type AuthorInfo = shell.AuthorInfo

AuthorInfo contains information about who created a file

type FileVersion

type FileVersion = shell.FileVersion

FileVersion represents the content of a file at a specific commit

type GitOps

type GitOps interface {
	Add(paths ...string) error
	Remove(paths ...string) error
	CurrentUser() (name string, email string, err error)
	Author(filePath string) (*AuthorInfo, error)
	AllAuthors(dirPattern string) (map[string]*AuthorInfo, error)
	LastCommitTime(filePath string) (time.Time, error)
	AllLastCommitTimes(dirPattern string) (map[string]time.Time, error)
	CurrentBranch() (string, error)
	FileVersionsSince(filePath string, since time.Time, includePrior bool) ([]FileVersion, error)
	AllFileVersionsSince(dirPattern string, since time.Time, includePrior bool) (map[string][]FileVersion, error)
	AllUsers() ([]string, error)
}

GitOps defines the interface for git operations

func NewGitOps

func NewGitOps(repoPath string) (GitOps, error)

NewGitOps creates a new GitOps instance using the shell-out implementation by default

type GitShellUtil

type GitShellUtil = shell.Util

GitShellUtil is an alias to shell.Util for backward compatibility

func NewGitShellUtil

func NewGitShellUtil(repoPath string) (*GitShellUtil, error)

NewGitShellUtil creates a new shell-based Git utility

type GitUtil

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

GitUtil provides Git operations using go-git library

func NewGitUtilWithGoGit

func NewGitUtilWithGoGit(repoPath string) (*GitUtil, error)

NewGitUtilWithGoGit creates a new GitUtil instance using go-git

func (*GitUtil) Add

func (g *GitUtil) Add(paths ...string) error

Add stages files to the git index (git add)

func (*GitUtil) Author

func (g *GitUtil) Author(filePath string) (*AuthorInfo, error)

Author returns information about who created a file

func (*GitUtil) CurrentBranch

func (g *GitUtil) CurrentBranch() (string, error)

CurrentBranch returns the name of the currently active branch

func (*GitUtil) CurrentUser

func (g *GitUtil) CurrentUser() (name string, email string, err error)

CurrentUser returns the current git user's name and email

func (*GitUtil) FileVersionsSince

func (g *GitUtil) FileVersionsSince(filePath string, since time.Time, includePrior bool) ([]FileVersion, error)

FileVersionsSince returns file contents for commits since the provided time. if includePrior is true, the most recent commit before the given time is included as the first version.

func (*GitUtil) Remove

func (g *GitUtil) Remove(paths ...string) error

Remove removes files from the git index and working directory (git rm)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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