gitutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gitutil wraps the git CLI operations needed by commit-spark.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertGitRepo

func AssertGitRepo(ctx context.Context) (string, error)

AssertGitRepo runs `git rev-parse --show-toplevel`. It returns the repo root path, or *apperr.KnownError if the current directory is not inside a Git repository.

Types

type StagedDiff

type StagedDiff struct {
	Files []string
	Diff  string
}

StagedDiff is the result of GetStagedDiff.

func GetStagedDiff

func GetStagedDiff(ctx context.Context, excludeFiles []string) (*StagedDiff, error)

GetStagedDiff runs `git diff --cached --diff-algorithm=minimal`, applying the same lock-file auto-exclusion logic as the original TypeScript implementation: if any staged file is NOT a lock file, lock files (package-lock.json, pnpm-lock.yaml, *.lock) are excluded from the diff; if ALL staged files are lock files, they are kept. Returns (nil, nil) if there's nothing staged after exclusion.

Jump to

Keyboard shortcuts

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