git

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package git provides reusable git operations for the CLI and tooling layers. These helpers are used by fmt --staged, tidy --staged, and gen --if-changed to interact with the git index and diff machinery.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPathsChanged

func HasPathsChanged(
	ctx context.Context,
	r system.CommandRunner,
	root string,
	from string,
	to string,
	paths ...string,
) (bool, error)

HasPathsChanged reports whether any of the given paths differ between two git refs. It returns true when git diff --quiet exits non-zero (meaning there are differences).

func StageFiles

func StageFiles(
	ctx context.Context,
	r system.CommandRunner,
	root string,
	paths ...string,
) error

StageFiles runs git add on the given paths.

func StagedFiles

func StagedFiles(
	ctx context.Context,
	r system.CommandRunner,
	root string,
	patterns ...string,
) ([]string, error)

StagedFiles returns root-relative paths of staged files matching the given path patterns. It uses git diff --cached --name-only --diff-filter=ACM to list only added, copied, or modified files (excluding deletions).

Types

This section is empty.

Jump to

Keyboard shortcuts

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