git

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package git provides utilities for working with git repositories, including diff-aware analysis support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangedFiles

func ChangedFiles(repoRoot, ref string) ([]string, error)

ChangedFiles returns files changed relative to the given ref. It runs: git diff <ref> --name-only

func ChangedFilesStaged

func ChangedFilesStaged(repoRoot, ref string) ([]string, error)

ChangedFilesStaged returns files changed in the staging area (git diff --cached).

func FindRepoRoot

func FindRepoRoot(path string) (string, error)

FindRepoRoot finds the git repository root from a given path.

Types

type LineRange

type LineRange struct {
	Start int
	End   int
}

LineRange represents a range of changed lines from a git diff (1-based).

func ChangedLines

func ChangedLines(repoRoot, ref, file string) ([]LineRange, error)

ChangedLines returns the line ranges changed in a file relative to the given ref. Uses git diff with -U0 (no context) to get only the changed line numbers.

Jump to

Keyboard shortcuts

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