git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckGitRepository

func CheckGitRepository(ctx context.Context) bool

CheckGitRepository verifies if the current folder is a Git repository using go-git.

func CommitChanges

func CommitChanges(ctx context.Context, commitMessage string) error

CommitChanges creates a commit with the provided message using go-git.

func FilterLockFiles

func FilterLockFiles(diff string, lockFiles []string) string

FilterLockFiles removes diff sections of lock files from the analysis.

func GetCurrentBranch

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

GetCurrentBranch returns the current Git branch name using go-git.

func GetGitDiff

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

GetGitDiff returns a unified diff of staged changes by comparing the HEAD tree and the working directory. This version skips diffing files that are detected as binary.

func GetHeadCommitMessage added in v0.1.0

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

GetHeadCommitMessage retrieves the last commit message on HEAD using go-git.

Types

type DiffChunk added in v0.1.0

type DiffChunk struct {
	FilePath   string
	HunkHeader string
	Lines      []string
}

DiffChunk represents a single "hunk" within a diff for a particular file.

func ParseDiffToChunks added in v0.1.0

func ParseDiffToChunks(diff string) ([]DiffChunk, error)

ParseDiffToChunks splits a unified diff into a list of DiffChunk structs.

Jump to

Keyboard shortcuts

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