Documentation
¶
Overview ¶
Package git provides Git repository operations including clone, pull, and authentication.
Index ¶
- type GitService
- func (s *GitService) Clone(gitURL string, gitBranch string, gitAuth *domain.GitAuthConfig, ...) error
- func (s *GitService) Fetch(gitBranch string, gitAuth *domain.GitAuthConfig, workingDir string) error
- func (s *GitService) GetDefaultBranch(gitURL string, gitAuth *domain.GitAuthConfig) (string, error)
- func (s *GitService) GetLatestCommit(workingDir string) (string, error)
- func (s *GitService) GetRemoteLatestCommit(workingDir string, gitBranch string) (string, error)
- func (s *GitService) Pull(gitBranch string, gitAuth *domain.GitAuthConfig, workingDir string) error
- func (s *GitService) TestAuthentication(gitURL string, gitAuth *domain.GitAuthConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitService ¶
type GitService struct {
// contains filtered or unexported fields
}
func NewGitService ¶
func NewGitService(config *oarconfig.Config) *GitService
func (*GitService) Clone ¶
func (s *GitService) Clone(gitURL string, gitBranch string, gitAuth *domain.GitAuthConfig, workingDir string) error
Clone clones a repository with optional authentication and branch
func (*GitService) Fetch ¶
func (s *GitService) Fetch(gitBranch string, gitAuth *domain.GitAuthConfig, workingDir string) error
Fetch fetches the latest changes from remote without merging
func (*GitService) GetDefaultBranch ¶
func (s *GitService) GetDefaultBranch(gitURL string, gitAuth *domain.GitAuthConfig) (string, error)
GetDefaultBranch determines the default branch of a remote Git repository
func (*GitService) GetLatestCommit ¶
func (s *GitService) GetLatestCommit(workingDir string) (string, error)
GetLatestCommit returns the latest commit hash
func (*GitService) GetRemoteLatestCommit ¶
func (s *GitService) GetRemoteLatestCommit(workingDir string, gitBranch string) (string, error)
GetRemoteLatestCommit returns the latest commit hash from the remote branch
func (*GitService) Pull ¶
func (s *GitService) Pull(gitBranch string, gitAuth *domain.GitAuthConfig, workingDir string) error
Pull pulls latest changes from remote with optional authentication Uses fetch + reset approach to handle force-pushes (equivalent to git fetch && git reset --hard origin/branch)
func (*GitService) TestAuthentication ¶
func (s *GitService) TestAuthentication(gitURL string, gitAuth *domain.GitAuthConfig) error
TestAuthentication tests Git authentication using ls-remote operation This is more resistant to credential caching than clone operations