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 ¶
- func HasPathsChanged(ctx context.Context, r system.CommandRunner, root string, from string, ...) (bool, error)
- func StageFiles(ctx context.Context, r system.CommandRunner, root string, paths ...string) error
- func StagedFiles(ctx context.Context, r system.CommandRunner, root string, patterns ...string) ([]string, error)
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 ¶
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.