gitcli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package gitcli provides native git CLI execution for blame operations. It shells out to the system git binary for blame (which uses packfile indexes and runs in milliseconds) while the rest of stringer uses go-git for commit iteration, branch listing, and repo detection. See DR-011 for rationale.

Index

Constants

View Source
const DefaultTimeout = 5 * time.Second

DefaultTimeout is the per-file blame timeout per DR-011.

Variables

This section is empty.

Functions

func Available

func Available() error

Available returns nil if git is on PATH, or an error otherwise.

func Exec

func Exec(ctx context.Context, repoDir string, args ...string) (string, error)

Exec runs git with the given arguments in repoDir and returns combined stdout.

Types

type BlameLine

type BlameLine struct {
	AuthorName string
	AuthorTime time.Time
}

BlameLine holds attribution data for a single source line.

func BlameFile

func BlameFile(ctx context.Context, repoDir, relPath string) ([]BlameLine, error)

BlameFile runs `git blame --porcelain -- <relPath>` and returns one BlameLine per source line.

func BlameSingleLine

func BlameSingleLine(ctx context.Context, repoDir, relPath string, line int) (*BlameLine, error)

BlameSingleLine runs `git blame --porcelain -L <line>,<line> -- <relPath>` and returns the attribution for that line.

Jump to

Keyboard shortcuts

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