Documentation
¶
Overview ¶
Package git provides Git operations for dependency updates
Package git provides Git operations for dependency updates
Index ¶
- func CheckGitInstalled() error
- type DefaultGitOperator
- func (g *DefaultGitOperator) CommitChanges(commitMessage string) error
- func (g *DefaultGitOperator) CreateBranch(newBranchName string) error
- func (g *DefaultGitOperator) DeleteBranch(branchName string) error
- func (g *DefaultGitOperator) GetCommitID() (string, error)
- func (g *DefaultGitOperator) GetCurrentBranch() (string, error)
- func (g *DefaultGitOperator) GetRepoURL() (string, error)
- func (g *DefaultGitOperator) HasChanges() (bool, error)
- func (g *DefaultGitOperator) PushBranch() error
- type GitCloner
- type GitOperator
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckGitInstalled ¶
func CheckGitInstalled() error
CheckGitInstalled checks if git CLI is available
Types ¶
type DefaultGitOperator ¶
type DefaultGitOperator struct {
// contains filtered or unexported fields
}
DefaultGitOperator implements GitOperator interface using system git commands
func NewGitOperator ¶
func NewGitOperator(workingDir string) *DefaultGitOperator
NewGitOperator creates a new Git operator
func (*DefaultGitOperator) CommitChanges ¶
func (g *DefaultGitOperator) CommitChanges(commitMessage string) error
CommitChanges commits all changes with the given message
func (*DefaultGitOperator) CreateBranch ¶
func (g *DefaultGitOperator) CreateBranch(newBranchName string) error
CreateBranch creates a new branch from the current branch
func (*DefaultGitOperator) DeleteBranch ¶
func (g *DefaultGitOperator) DeleteBranch(branchName string) error
func (*DefaultGitOperator) GetCommitID ¶
func (g *DefaultGitOperator) GetCommitID() (string, error)
GetCommitID returns the commit ID of the current branch
func (*DefaultGitOperator) GetCurrentBranch ¶
func (g *DefaultGitOperator) GetCurrentBranch() (string, error)
GetCurrentBranch returns the current branch name
func (*DefaultGitOperator) GetRepoURL ¶
func (g *DefaultGitOperator) GetRepoURL() (string, error)
GetRepo retrieves the repository information from the current working directory It returns the repository URL and parses it into a Repository struct
func (*DefaultGitOperator) HasChanges ¶
func (g *DefaultGitOperator) HasChanges() (bool, error)
HasChanges returns true if there are uncommitted changes
func (*DefaultGitOperator) PushBranch ¶
func (g *DefaultGitOperator) PushBranch() error
PushBranch pushes the current branch to remote origin
type GitCloner ¶
type GitCloner struct {
// contains filtered or unexported fields
}
GitCloner handles automatic repository cloning
func NewGitClonerFromConfig ¶
func NewGitClonerFromConfig(repoConfig *config.RepoConfig) *GitCloner
NewGitClonerFromConfig creates a new git cloner from repository configuration
func (*GitCloner) CloneRepository ¶
CloneRepository clones the repository and returns the path to the cloned directory
func (*GitCloner) GetClonedPath ¶
GetClonedPath returns the path to the cloned repository
func (*GitCloner) GetTempDir ¶
GetTempDir returns the temporary directory path (useful for testing)
type GitOperator ¶
type GitOperator interface {
// CreateBranch creates a new branch from the current branch
CreateBranch(branchName string) error
// CommitChanges commits all changes with the given message
CommitChanges(commitMessage string) error
// PushBranch pushes the current branch to remote origin
PushBranch() error
// GetCurrentBranch returns the current branch name
GetCurrentBranch() (string, error)
// HasChanges returns true if there are uncommitted changes
HasChanges() (bool, error)
}
GitOperator defines the interface for Git operations
type Repository ¶
Repository represents a Git repository with its group and name.
func ParseRepoURL ¶
func ParseRepoURL(repoURL string) (*Repository, error)
ParseRepoURL extracts the repository name and owner from a Git repository URL. It supports various formats including: - https://github.com/example/toolbox.git => group: example, repo: toolbox - https://gitlab.com/group/repo.git => group: group, repo: repo - https://gitlab.example.com/group/subgroup/repo.git => group: group/subgroup, repo: repo
func (*Repository) String ¶
func (r *Repository) String() string
String returns the repository in the format "group/repo".
func (*Repository) UrlEncode ¶
func (r *Repository) UrlEncode() string
UrlEncode returns the repository string encoded for use in URLs.