git

package
v0.0.0-...-a6ba8f7 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package git provides Git repository operations including clone, pull, and authentication.

Index

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

Jump to

Keyboard shortcuts

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