gitinfo

package
v0.5.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gitinfo provides lightweight, cached git metadata (last-commit dates) for content files. It shells out to `git` and degrades silently when git is unavailable or the project is not a repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available(root string) bool

Available reports whether git metadata can be read for root.

func LastAuthors

func LastAuthors(root, path string, n int) []string

LastAuthors returns up to n distinct author names from the most recent commits touching path, most recent first. It returns nil when git is unavailable or the file is untracked/unchanged. Results are cached per (root, repository-relative path, n).

func LastCommit

func LastCommit(root, path string) string

LastCommit returns the committer date (RFC3339) of the last commit touching path, or "" when git is unavailable or the file is untracked/unchanged. Backed by a single-pass per-root index (built once per process).

Types

type Index

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

Index holds per-file git metadata computed in a single `git log` pass, so a build reads commit dates/authors for every page without spawning a git process per file.

func (*Index) Authors

func (ix *Index) Authors(path string, n int) []string

Authors returns up to n distinct recent authors of path (most recent first).

func (*Index) LastCommit

func (ix *Index) LastCommit(path string) string

LastCommit returns the committer date (RFC3339) of the last commit touching path, or "" when unknown.

Jump to

Keyboard shortcuts

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