Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultBranch ¶
DefaultBranch returns the current branch name or HEAD.
func ListBranches ¶
ListBranches returns all local branch names.
func TotalCommits ¶
TotalCommits returns the total number of commits on a branch without loading them all.
Types ¶
type Author ¶
Author represents a unique contributor with display attributes.
type ChangeStatus ¶
type ChangeStatus int
ChangeStatus describes how a file changed in a commit.
const ( StatusAdded ChangeStatus = iota StatusModified StatusDeleted StatusRenamed )
func (ChangeStatus) Prefix ¶
func (s ChangeStatus) Prefix() string
Prefix returns the display prefix character for a file change.
func (ChangeStatus) String ¶
func (s ChangeStatus) String() string
type Commit ¶
type Commit struct {
Hash string
ShortHash string
Author string
Email string
Timestamp time.Time
Subject string
Body string
Index int // position in the full history (0-based)
}
Commit represents a single git commit.
func LoadHistory ¶
LoadHistory parses the full git commit log for the given directory and branch. maxCount = 0 means no limit.
func (*Commit) FormattedDate ¶
FormattedDate returns a nicely formatted date string.
func (*Commit) RelativeTime ¶
RelativeTime returns a human-friendly relative time string.
type CommitStats ¶
type CommitStats struct {
Files int
Additions int
Deletions int
Changes []FileChange
}
CommitStats holds aggregate stats for a commit.
func LoadDiff ¶
func LoadDiff(dir, hash string) (*CommitStats, error)
LoadDiff returns the file changes for a given commit hash. Results are cached in memory.
type FileChange ¶
type FileChange struct {
Path string
OldPath string // non-empty for renames
Status ChangeStatus
Additions int
Deletions int
}
FileChange holds change details for one file in a commit.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks all unique authors encountered in the history.
func BuildRegistry ¶
BuildRegistry walks the full commit history and registers all authors.