Documentation
¶
Index ¶
- Variables
- func LoadLocalExcludes(repoPath string) ([]gitignore.Pattern, error)
- func LoadLocalIgnore(repoPath string) ([]gitignore.Pattern, error)
- func LoadUserExcludes(repoPath string) ([]gitignore.Pattern, error)
- type GitService
- func (s *GitService) AuthenticateWithUsernamePassword(_ context.Context, username string, password string) (coregit.GitService, error)
- func (s *GitService) Clone(ctx context.Context, remoteURL string, localPath string, ...) error
- func (s *GitService) GetDefaultRemotes(ctx context.Context, localPath string) ([]string, error)
- func (s *GitService) GetRemotes(ctx context.Context, localPath string, name string) ([]string, error)
- func (s *GitService) Init(_ context.Context, remoteURL, localPath string, isBare bool, ...) error
- func (s *GitService) ListAllFiles(ctx context.Context, localPath string, filePatterns []string) iter.Seq2[string, error]
- func (s *GitService) ListExcludedFiles(ctx context.Context, localPath string, filePatterns []string) iter.Seq2[string, error]
- func (s *GitService) SetDefaultRemotes(ctx context.Context, localPath string, remotes []string) error
- func (s *GitService) SetRemotes(_ context.Context, localPath string, name string, remotes []string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
var CloneProgressWriter = func(w io.Writer) Option { return func(s *GitService) { s.cloneProgressWriter = w } }
var (
UserExcludesFile = defaultUserExcludesFile
)
Function variables that can be mocked in tests
Functions ¶
func LoadLocalExcludes ¶ added in v4.0.2
LoadLocalExcludes loads the local gitignore patterns from the .git/info/exclude file.
func LoadLocalIgnore ¶ added in v4.0.2
LoadLocalIgnore loads the local gitignore patterns from the .gitignore file.
func LoadUserExcludes ¶ added in v4.0.2
LoadUserExcludes loads the user's gitignore patterns from the core.excludesfile property. It reads the user's gitignore file, which is typically located at `$XDG_CONFIG_HOME/git/ignore` or `$HOME/.config/git/ignore`. If the core.excludesfile property is not declared in the user's git config, it defaults to the same path. See: UserExcludesFile for more details on how the file is determined.
Types ¶
type GitService ¶
type GitService struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(options ...Option) *GitService
NewService creates a new Service instance without authentication.
func (*GitService) AuthenticateWithUsernamePassword ¶
func (s *GitService) AuthenticateWithUsernamePassword(_ context.Context, username string, password string) (coregit.GitService, error)
AuthenticateWithUsernamePassword implements git.GitService.
func (*GitService) Clone ¶
func (s *GitService) Clone(ctx context.Context, remoteURL string, localPath string, opts coregit.CloneOptions) error
Clone clones a remote repository to a local path.
func (*GitService) GetDefaultRemotes ¶
GetDefaultRemotes retrieves the default remote repositories for a local git repository.
func (*GitService) GetRemotes ¶
func (s *GitService) GetRemotes( ctx context.Context, localPath string, name string, ) ([]string, error)
GetRemotes retrieves the remote repositories for a local git repository.
func (*GitService) Init ¶
func (s *GitService) Init(_ context.Context, remoteURL, localPath string, isBare bool, _ coregit.InitOptions) error
Init initializes a new git repository at the specified local path.
func (*GitService) ListAllFiles ¶ added in v4.0.2
func (s *GitService) ListAllFiles( ctx context.Context, localPath string, filePatterns []string, ) iter.Seq2[string, error]
ListAllFiles returns a list of all files in the repository. It includes `.git` directory.
func (*GitService) ListExcludedFiles ¶ added in v4.0.2
func (s *GitService) ListExcludedFiles( ctx context.Context, localPath string, filePatterns []string, ) iter.Seq2[string, error]
ListExcludedFiles returns a list of excluded/ignored files in the repository.
func (*GitService) SetDefaultRemotes ¶
func (s *GitService) SetDefaultRemotes( ctx context.Context, localPath string, remotes []string, ) error
SetDefaultRemotes sets the default remote repositories for a local git repository.
func (*GitService) SetRemotes ¶
func (s *GitService) SetRemotes( _ context.Context, localPath string, name string, remotes []string, ) error
SetRemotes sets the remote repositories for a local git repository.
type Option ¶ added in v4.0.2
type Option func(*GitService)