Documentation
¶
Index ¶
- func BlameFileAtParent(ctx context.Context, repoPath, commitHash, filepath string) ([]string, error)
- func DiffTreeFiles(ctx context.Context, repoPath, commitHash string) ([]string, error)
- func FindCommitAtDate(ctx context.Context, repoPath string, before time.Time) (string, error)
- func FindRevertedCommits(ctx context.Context, repoPath string) (map[string]bool, error)
- func HeadHash(ctx context.Context, repoPath string) (string, error)
- func IsShallowRepo(ctx context.Context, repoPath string) bool
- func ListAllFiles(ctx context.Context, repoPath string) ([]string, error)
- func ListFiles(ctx context.Context, repoPath string, patterns []string) ([]string, error)
- func ListFilesAtCommit(ctx context.Context, repoPath, commitHash string, patterns []string) ([]string, error)
- func RunLines(ctx context.Context, repoPath string, args ...string) ([]string, error)
- func RunStream(ctx context.Context, repoPath string, args ...string) (io.ReadCloser, *exec.Cmd, error)
- func SampleFiles(files []string, maxFiles int) []string
- type BlameLine
- func BlameFile(ctx context.Context, repoPath, filepath string) ([]BlameLine, error)
- func BlameFileAtCommit(ctx context.Context, repoPath, commitHash, filepath string) ([]BlameLine, error)
- func BlameFileStream(ctx context.Context, repoPath, filepath string) ([]BlameLine, error)
- func BlameFiles(ctx context.Context, repoPath string, files []string, maxFiles int, ...) ([]BlameLine, error)
- func ConcurrentBlameFiles(ctx context.Context, repoPath string, files []string, maxFiles, workers int, ...) ([]BlameLine, error)
- func ConcurrentBlameFilesAtCommit(ctx context.Context, repoPath, commitHash string, files []string, ...) ([]BlameLine, error)
- type Commit
- type FileStat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlameFileAtParent ¶
func DiffTreeFiles ¶
func FindCommitAtDate ¶
FindCommitAtDate returns the latest commit hash on or before the given date.
func FindRevertedCommits ¶ added in v1.1.0
FindRevertedCommits detects commits that have been reverted and returns the set of commit hashes that should be excluded from metric calculations.
This handles:
- Non-merge reverts: `git revert <hash>` → excludes original + revert commit
- Merge reverts (PR reverts): excludes all commits in the merged branch
- Revert-of-revert: if a revert is itself reverted, the original is reinstated
Both the reverted original commits and the revert commits themselves are excluded, so the net effect is as if the reverted changes never happened.
func IsShallowRepo ¶
IsShallowRepo checks if the repository is a shallow clone
func ListAllFiles ¶
ListAllFiles returns all tracked files in the repo (for domain auto-detection)
func ListFilesAtCommit ¶
func ListFilesAtCommit(ctx context.Context, repoPath, commitHash string, patterns []string) ([]string, error)
ListFilesAtCommit returns tracked files at a specific commit hash, filtered by patterns.
func SampleFiles ¶
SampleFiles performs stratified sampling by module to ensure every module is represented. Each module (first 3 directory components) gets at least minPerModule files, with remaining budget allocated proportionally.
Types ¶
type BlameLine ¶
func BlameFileAtCommit ¶
func BlameFileAtCommit(ctx context.Context, repoPath, commitHash, filepath string) ([]BlameLine, error)
BlameFileAtCommit runs blame at a specific commit hash.
func BlameFileStream ¶
BlameFilesStream processes blame with a scanner for memory efficiency on large repos
func BlameFiles ¶
func ConcurrentBlameFiles ¶
func ConcurrentBlameFiles(ctx context.Context, repoPath string, files []string, maxFiles, workers int, progressFn func(done, total int), verboseFn func(string)) ([]BlameLine, error)
ConcurrentBlameFiles runs blame on files concurrently with a worker pool
func ConcurrentBlameFilesAtCommit ¶
func ConcurrentBlameFilesAtCommit(ctx context.Context, repoPath, commitHash string, files []string, maxFiles, workers int, progressFn func(done, total int), verboseFn func(string)) ([]BlameLine, error)
ConcurrentBlameFilesAtCommit runs blame at a specific commit on files concurrently.