gitlog

package
v0.56.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Roots(ctx context.Context, dir string) []string

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 First

func First(ctx context.Context, root, path string) (Commit, bool)

First returns the commit that introduced path, if any.

func Recent

func Recent(ctx context.Context, root, path string, n int) []Commit

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.

Jump to

Keyboard shortcuts

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