git

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExists added in v0.14.0

func FileExists(path string) (bool, error)

FileExists checks whether a file exists on disk.

func GetCommitDartFiles

func GetCommitDartFiles(repoPath, commitID string) ([]string, error)

GetCommitDartFiles finds all files that were changed in a specific commit. Returns absolute paths to all files added, modified, or renamed in the commit.

func GetCommitFileStats

func GetCommitFileStats(repoPath, commitID string) (map[string]vcs.FileStats, error)

GetCommitFileStats returns statistics (additions/deletions) for files in a specific commit Returns a map from absolute file paths to their FileStats

func GetCommitRangeFileStats

func GetCommitRangeFileStats(repoPath, fromCommit, toCommit string) (map[string]vcs.FileStats, error)

GetCommitRangeFileStats returns statistics (additions/deletions) for files changed between two commits. Returns a map from absolute file paths to their FileStats.

func GetCommitRangeFiles

func GetCommitRangeFiles(repoPath, fromCommit, toCommit string) ([]string, error)

GetCommitRangeFiles finds all files changed between two commits. Uses: git diff --name-only --diff-filter=d <from> <to> Returns absolute paths to all files added, modified, or renamed between the commits.

func GetCommitRangeLabel

func GetCommitRangeLabel(repoPath, fromCommit, toCommit string) (string, error)

GetCommitRangeLabel returns a label like "abc123...def456" for display

func GetCommitTreeFiles

func GetCommitTreeFiles(repoPath, commitID string) ([]string, error)

GetCommitTreeFiles returns all files that exist in a commit's tree. Unlike GetCommitDartFiles which only returns files changed in a commit, this returns all files that existed at that point in time. Returns absolute paths to all files in the commit tree.

func GetCurrentCommitHash

func GetCurrentCommitHash(repoPath string) (string, error)

GetCurrentCommitHash returns the current commit hash (HEAD)

func GetFileContentFromCommit

func GetFileContentFromCommit(repoPath, commitID, filePath string) ([]byte, error)

GetFileContentFromCommit reads the content of a file at a specific commit using 'git show commit:path'. The filePath should be relative to the repository root.

func GetRepositoryRoot

func GetRepositoryRoot(repoPath string) (string, error)

GetRepositoryRoot returns the absolute path to the repository root

func GetShortCommitHash

func GetShortCommitHash(repoPath, commitID string) (string, error)

GetShortCommitHash returns the short version of a given commit hash

func GetUncommittedFileStats

func GetUncommittedFileStats(repoPath string) (map[string]vcs.FileStats, error)

GetUncommittedFileStats returns statistics (additions/deletions) for uncommitted files Returns a map from relative file paths to their FileStats

func GetUncommittedFiles

func GetUncommittedFiles(repoPath string) ([]string, error)

GetUncommittedFiles finds all uncommitted files in a git repository. Returns absolute paths to all uncommitted files (staged, unstaged, and untracked).

func GitCommitContentReader

func GitCommitContentReader(repoPath, commitID string) vcs.ContentReader

GitCommitContentReader returns a ContentReader that reads file content from a specific git commit.

func HasUncommittedChanges

func HasUncommittedChanges(repoPath string) (bool, error)

HasUncommittedChanges checks if there are any uncommitted changes in the repository

func ListTrackedFiles added in v0.14.0

func ListTrackedFiles(repoPath string) ([]string, error)

ListTrackedFiles returns absolute paths for files tracked in the git index.

func ListUntrackedFiles added in v0.14.0

func ListUntrackedFiles(repoPath string) ([]string, error)

ListUntrackedFiles returns absolute paths for non-ignored untracked files.

func NormalizeCommitRange

func NormalizeCommitRange(repoPath, from, to string) (string, string, bool, error)

NormalizeCommitRange ensures commits are in chronological order (older first). If the commits are reversed (newer...older), it swaps them. Returns (olderCommit, newerCommit, swapped, error)

func ParseCommitRange

func ParseCommitRange(commitSpec string) (string, string, bool)

ParseCommitRange parses a commit specification and returns the from/to commits. Supports formats: "abc...def", "abc..def", or single commit "abc" Returns (from, to, isRange)

func ResolveFirstParent added in v0.14.0

func ResolveFirstParent(repoPath, commitID string) (parent string, hasParent bool, err error)

ResolveFirstParent resolves the first parent of a commit. Returns hasParent=false for root commits.

func ValidateCommit added in v0.14.0

func ValidateCommit(repoPath, commitID string) error

ValidateCommit validates that a commit reference resolves in the given repository.

Types

This section is empty.

Jump to

Keyboard shortcuts

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