git

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package git provides utilities for interacting with git repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterGoFiles

func FilterGoFiles(files []string) []string

FilterGoFiles filters a list of files to only include .go files.

func GetAllFileStatus

func GetAllFileStatus(ctx context.Context, dir string) (map[string]FileStatus, error)

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

func GetStagedContent(ctx context.Context, dir, path string) ([]byte, error)

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

func GetStagedDiff(ctx context.Context, dir string) (string, error)

GetStagedDiff returns the unified diff of staged changes in the specified directory. This represents what would be committed (git diff --cached).

func GetStagedFiles

func GetStagedFiles(ctx context.Context, dir string) ([]string, error)

GetStagedFiles returns the list of staged files in the specified directory. Only includes files that are added, copied, modified, or renamed (not deleted).

func GetUnstagedModified

func GetUnstagedModified(ctx context.Context, dir string) ([]string, error)

GetUnstagedModified returns the list of files with unstaged modifications in the specified directory.

Types

type FileStatus

type FileStatus struct {
	Staging  byte // Index status.
	Worktree byte // Working tree status.
}

FileStatus represents the git status of a file.

Jump to

Keyboard shortcuts

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