git

package
v4.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CloneProgressWriter = func(w io.Writer) Option {
	return func(s *GitService) {
		s.cloneProgressWriter = w
	}
}
View Source
var (
	UserExcludesFile = defaultUserExcludesFile
)

Function variables that can be mocked in tests

Functions

func LoadLocalExcludes added in v4.0.2

func LoadLocalExcludes(repoPath string) ([]gitignore.Pattern, error)

LoadLocalExcludes loads the local gitignore patterns from the .git/info/exclude file.

func LoadLocalIgnore added in v4.0.2

func LoadLocalIgnore(repoPath string) ([]gitignore.Pattern, error)

LoadLocalIgnore loads the local gitignore patterns from the .gitignore file.

func LoadUserExcludes added in v4.0.2

func LoadUserExcludes(repoPath string) ([]gitignore.Pattern, error)

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

func (s *GitService) GetDefaultRemotes(
	ctx context.Context,
	localPath string,
) ([]string, error)

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)

Jump to

Keyboard shortcuts

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