Documentation
¶
Overview ¶
Package internal contains internal utilities for gitcc.
Index ¶
- Variables
- func CopyFile(src string, dst string) error
- func GetMergeBase(repo *git.Repository, targetBranch string) (*object.Commit, error)
- func LoadRepository(path string) (*git.Repository, error)
- func ValidateCommit(validator gitcc.Validator, repo *git.Repository, sha string) (gitcc.Result, error)
- func ValidateHead(validator gitcc.Validator, repo *git.Repository) (gitcc.Result, error)
- func ValidateHistory(validator gitcc.Validator, repo *git.Repository, exitSha string) ([]gitcc.Result, error)
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSHA = errors.New("invalid SHA")
ErrInvalidSHA is returned when an invalid SHA string is provided.
var ErrNoCommonAncestor = errors.New("no common ancestor found")
ErrNoCommonAncestor is returned when no common ancestor is found between the source and target branches.
Functions ¶
func GetMergeBase ¶
GetMergeBase finds the common ancestor (merge base) between the current HEAD and the specified target branch. It returns ErrNoCommonAncestor if no common ancestor is found.
func LoadRepository ¶
func LoadRepository(path string) (*git.Repository, error)
LoadRepository opens a Git repository at the specified path. It detects the .git directory automatically.
func ValidateCommit ¶
func ValidateCommit(validator gitcc.Validator, repo *git.Repository, sha string) (gitcc.Result, error)
ValidateCommit validates a specific commit by its SHA string.
func ValidateHead ¶
ValidateHead validates the current HEAD commit.
func ValidateHistory ¶
func ValidateHistory(validator gitcc.Validator, repo *git.Repository, exitSha string) ([]gitcc.Result, error)
ValidateHistory validates the commit history starting from HEAD until the exitSha (exclusive). If exitSha is empty, it validates the entire history.
Types ¶
This section is empty.