Documentation
¶
Overview ¶
Package git provides utilities for interacting with git repositories.
Index ¶
- func FilterGoFiles(files []string) []string
- func GetAllFileStatus(ctx context.Context, dir string) (map[string]FileStatus, error)
- func GetStagedContent(ctx context.Context, dir, path string) ([]byte, error)
- func GetStagedDiff(ctx context.Context, dir string) (string, error)
- func GetStagedFiles(ctx context.Context, dir string) ([]string, error)
- func GetUnstagedModified(ctx context.Context, dir string) ([]string, error)
- type FileStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterGoFiles ¶
FilterGoFiles filters a list of files to only include .go files.
func GetAllFileStatus ¶
GetAllFileStatus returns the status of all files in the specified directory using git status --porcelain. The status uses two-character codes: first is staging area, second is working tree.
func GetStagedContent ¶
GetStagedContent reads the staged content of a file from the git index in the specified directory. This is important for files with partial staging.
func GetStagedDiff ¶ added in v0.0.2
GetStagedDiff returns the unified diff of staged changes in the specified directory. This represents what would be committed (git diff --cached).
func GetStagedFiles ¶
GetStagedFiles returns the list of staged files in the specified directory. Only includes files that are added, copied, modified, or renamed (not deleted).
Types ¶
type FileStatus ¶
FileStatus represents the git status of a file.