Documentation
¶
Overview ¶
Package gitlog is a tiny, dependency-free reader over `git log`, shared by the context compiler, provenance, predict and producer attribution. All functions degrade to empty results when git is unavailable or the path has no history.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Roots ¶ added in v0.46.0
Roots discovers every independent git work-tree root at or under dir. If dir itself is inside a work tree, that single root is returned — the common single-repo case, unchanged in cost and result. Otherwise dir is walked (bounded by depth and total directories visited) looking for nested ".git" entries; each one found is recorded as a root and its subtree is NOT descended into further, since it owns everything below it. Hidden directories and common dependency/build directories are skipped. Order is deterministic (sorted).
Types ¶
type Commit ¶
type Commit struct {
Hash string `json:"hash"`
Author string `json:"author"`
AuthorEmail string `json:"author_email"`
Date string `json:"date"`
Subject string `json:"subject"`
Body string `json:"body"`
}
Commit is one entry from git history.
func Recent ¶
Recent returns up to n most-recent commits touching path ("" or "." = whole repo), newest first. For the whole-repo case, root may be the parent of several independent repositories (e.g. two sibling projects under one non-git workspace dir) rather than a repo itself — Roots discovers every repo underneath and the results are merged by date.