Documentation
¶
Index ¶
- type ConflictHandler
- func (ch *ConflictHandler) ConfirmAction(message string, defaultValue bool) bool
- func (ch *ConflictHandler) DetectConflicts(sourceBranch, targetBranch string, mergeErr error) *MergeConflict
- func (ch *ConflictHandler) HandleConflict(conflict *MergeConflict) (ConflictResolution, error)
- func (ch *ConflictHandler) IsTerminal() bool
- type ConflictResolution
- type GitRepository
- type InputSanitizer
- func (s *InputSanitizer) SanitizeBranchName(branch string) error
- func (s *InputSanitizer) SanitizeCommitMessage(message string) error
- func (s *InputSanitizer) SanitizeEnvironmentVariable(name, value string) error
- func (s *InputSanitizer) SanitizeFileName(filename string) error
- func (s *InputSanitizer) SanitizeRemoteName(remote string) error
- func (s *InputSanitizer) SanitizeURL(url string) error
- func (s *InputSanitizer) ValidateGitConfigKey(key string) error
- func (s *InputSanitizer) ValidateGitConfigValue(value string) error
- func (s *InputSanitizer) ValidateRef(ref string) error
- type MergeConflict
- type MergeConflictError
- type Repo
- func (r *Repo) BranchExists(name string) bool
- func (r *Repo) CanMerge(branch string) (bool, error)
- func (r *Repo) Checkout(ref string) error
- func (r *Repo) CreateBranch(name string, fromRef string) error
- func (r *Repo) CurrentBranch() (string, error)
- func (r *Repo) CurrentCommitSHA() (string, error)
- func (r *Repo) DeleteBranch(name string, force bool) error
- func (r *Repo) DeleteRemoteBranch(remoteName string, branchName string) error
- func (r *Repo) HasUncommittedChanges(branch string) (bool, error)
- func (r *Repo) IsDetachedHead() bool
- func (r *Repo) IsGitRepository() bool
- func (r *Repo) IsMergeInProgress() bool
- func (r *Repo) Merge(branch string, message string) error
- func (r *Repo) MergeAbort() error
- func (r *Repo) MergeSquash(branch string, message string) error
- func (r *Repo) Pull(remoteName string, branchName string) error
- func (r *Repo) Push(remoteName string, branchName string, force bool) error
- func (r *Repo) UserEmail() (string, error)
- func (r *Repo) UserName() (string, error)
- func (r *Repo) WorkingTree() string
- type RepositoryValidator
- type ValidationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConflictHandler ¶ added in v0.1.21
type ConflictHandler struct {
// contains filtered or unexported fields
}
ConflictHandler manages interactive merge conflict resolution
func NewConflictHandler ¶ added in v0.1.21
func NewConflictHandler(repo *Repo) *ConflictHandler
NewConflictHandler creates a new conflict handler
func (*ConflictHandler) ConfirmAction ¶ added in v0.1.21
func (ch *ConflictHandler) ConfirmAction(message string, defaultValue bool) bool
ConfirmAction asks for user confirmation with a custom message
func (*ConflictHandler) DetectConflicts ¶ added in v0.1.21
func (ch *ConflictHandler) DetectConflicts(sourceBranch, targetBranch string, mergeErr error) *MergeConflict
DetectConflicts analyzes a merge error to extract conflict information
func (*ConflictHandler) HandleConflict ¶ added in v0.1.21
func (ch *ConflictHandler) HandleConflict(conflict *MergeConflict) (ConflictResolution, error)
HandleConflict presents the interactive conflict resolution interface
func (*ConflictHandler) IsTerminal ¶ added in v0.1.21
func (ch *ConflictHandler) IsTerminal() bool
IsTerminal checks if we're running in an interactive terminal
type ConflictResolution ¶ added in v0.1.21
type ConflictResolution int
ConflictResolution represents the user's choice for conflict resolution
const ( ResolutionRollback ConflictResolution = iota ResolutionPause ResolutionManual )
type GitRepository ¶ added in v0.1.21
type GitRepository interface {
// Core repository information
WorkingTree() string
CurrentBranch() (string, error)
IsDetachedHead() bool
CurrentCommitSHA() (string, error)
IsGitRepository() bool
// User configuration
UserName() (string, error)
UserEmail() (string, error)
HasUncommittedChanges(branch string) (bool, error)
}
GitRepository defines the interface for Git operations This provides abstraction for Git repository operations while maintaining testability
type InputSanitizer ¶ added in v0.1.21
type InputSanitizer struct{}
InputSanitizer validates and sanitizes user inputs for git commands
func NewInputSanitizer ¶ added in v0.1.21
func NewInputSanitizer() *InputSanitizer
NewInputSanitizer creates a new input sanitizer
func (*InputSanitizer) SanitizeBranchName ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeBranchName(branch string) error
SanitizeBranchName validates that a branch name is safe for git operations
func (*InputSanitizer) SanitizeCommitMessage ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeCommitMessage(message string) error
SanitizeCommitMessage validates that a commit message is safe
func (*InputSanitizer) SanitizeEnvironmentVariable ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeEnvironmentVariable(name, value string) error
SanitizeEnvironmentVariable validates that an environment variable name and value are safe
func (*InputSanitizer) SanitizeFileName ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeFileName(filename string) error
SanitizeFileName validates that a filename is safe for git operations
func (*InputSanitizer) SanitizeRemoteName ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeRemoteName(remote string) error
SanitizeRemoteName validates that a remote name is safe
func (*InputSanitizer) SanitizeURL ¶ added in v0.1.21
func (s *InputSanitizer) SanitizeURL(url string) error
SanitizeURL validates that a URL is safe for git operations
func (*InputSanitizer) ValidateGitConfigKey ¶ added in v0.1.21
func (s *InputSanitizer) ValidateGitConfigKey(key string) error
ValidateGitConfigKey validates that a git config key is safe
func (*InputSanitizer) ValidateGitConfigValue ¶ added in v0.1.21
func (s *InputSanitizer) ValidateGitConfigValue(value string) error
ValidateGitConfigValue validates that a git config value is safe
func (*InputSanitizer) ValidateRef ¶ added in v0.1.21
func (s *InputSanitizer) ValidateRef(ref string) error
ValidateRef validates that a git reference is safe
type MergeConflict ¶ added in v0.1.21
type MergeConflict struct {
SourceBranch string
TargetBranch string
ConflictingFiles []string
OriginalError error
IsSquashMerge bool
}
MergeConflict represents information about a merge conflict
type MergeConflictError ¶
MergeConflictError is returned when a merge results in conflicts
func (*MergeConflictError) Error ¶
func (e *MergeConflictError) Error() string
type Repo ¶
type Repo struct {
*git.Repository
// contains filtered or unexported fields
}
Repo wraps a git repository with helpful methods
func OpenRepo ¶
OpenRepo opens a git repository in the current or specified directory. If path is empty, it opens the repository in the current directory. Returns a Repo wrapper that provides additional helper methods.
func (*Repo) BranchExists ¶
BranchExists checks if a branch exists (local or remote)
func (*Repo) CanMerge ¶ added in v0.1.21
CanMerge checks if a merge would succeed without actually performing it
func (*Repo) CreateBranch ¶
CreateBranch creates a new branch
func (*Repo) CurrentBranch ¶
CurrentBranch returns the name of the current branch
func (*Repo) CurrentCommitSHA ¶
CurrentCommitSHA returns the SHA of the current commit
func (*Repo) DeleteBranch ¶
DeleteBranch deletes a branch
func (*Repo) DeleteRemoteBranch ¶
DeleteRemoteBranch deletes a branch from remote
func (*Repo) HasUncommittedChanges ¶
HasUncommittedChanges checks if a branch has uncommitted changes Note: This requires executing git commands as go-git doesn't support this well
func (*Repo) IsDetachedHead ¶
IsDetachedHead checks if HEAD is in detached state
func (*Repo) IsGitRepository ¶ added in v0.1.21
IsGitRepository checks if the current directory is a git repository
func (*Repo) IsMergeInProgress ¶ added in v0.1.21
IsMergeInProgress checks if there's an ongoing merge operation
func (*Repo) Merge ¶
Merge merges a branch into the current branch with an optional message Note: This uses git command as go-git's merge support is limited
func (*Repo) MergeSquash ¶
MergeSquash squash merges a branch into the current branch
func (*Repo) Push ¶
Push pushes changes to remote Uses force-with-lease for safety when force is specified
func (*Repo) WorkingTree ¶ added in v0.1.7
WorkingTree returns the working directory path of the repository
type RepositoryValidator ¶ added in v0.1.21
type RepositoryValidator struct {
// contains filtered or unexported fields
}
RepositoryValidator checks repository health and integrity
func NewRepositoryValidator ¶ added in v0.1.21
func NewRepositoryValidator(repo *Repo) *RepositoryValidator
NewRepositoryValidator creates a new repository validator
func (*RepositoryValidator) ValidateRepository ¶ added in v0.1.21
func (v *RepositoryValidator) ValidateRepository() ValidationResult
ValidateRepository performs comprehensive repository validation
type ValidationResult ¶ added in v0.1.21
ValidationResult contains the result of repository validation