Documentation
¶
Index ¶
- Variables
- func WithAuth(auth transport.AuthMethod) containers.Option[Repository]
- func WithBase(name string) containers.Option[CreateBranchOptions]
- func WithBranch(branch string) containers.Option[ViewUpdateOptions]
- func WithCABundle(caCertBytes []byte) containers.Option[Repository]
- func WithDefaultBranch(ref string) containers.Option[Repository]
- func WithFilesystemStorage(path string) containers.Option[Repository]
- func WithForce(vuo *ViewUpdateOptions)
- func WithInsecureTLS(insecureSkipTLS bool) containers.Option[Repository]
- func WithInterval(interval time.Duration) containers.Option[Repository]
- func WithMaxOpenDescriptors(n int) containers.Option[Repository]
- func WithRemote(name, url string) containers.Option[Repository]
- func WithRevision(rev plumbing.Hash) containers.Option[ViewUpdateOptions]
- func WithSignature(name, email string) containers.Option[Repository]
- type CreateBranchOptions
- type Repository
- func (r *Repository) Close() error
- func (r *Repository) CreateBranchIfNotExists(branch string, opts ...containers.Option[CreateBranchOptions]) error
- func (r *Repository) DefaultBranch() string
- func (r *Repository) Fetch(ctx context.Context, specific ...string) (err error)
- func (r *Repository) ListCommits(ctx context.Context, branch, from string, filter func(string) bool) (_ iter.Seq[*object.Commit], err error)
- func (r *Repository) Resolve(branch string) (plumbing.Hash, error)
- func (r *Repository) Subscribe(sub Subscriber)
- func (r *Repository) UpdateAndPush(ctx context.Context, fn func(fs fs.Filesystem) (string, error), ...) (hash plumbing.Hash, err error)
- func (r *Repository) View(ctx context.Context, fn func(hash plumbing.Hash, fs fs.Filesystem) error, ...) (err error)
- type Subscriber
- type ViewUpdateOptions
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyCommit = errors.New("empty commit")
Functions ¶
func WithAuth ¶
func WithAuth(auth transport.AuthMethod) containers.Option[Repository]
WithAuth returns an option which configures the auth method used by the provided source.
func WithBase ¶
func WithBase(name string) containers.Option[CreateBranchOptions]
func WithBranch ¶
func WithBranch(branch string) containers.Option[ViewUpdateOptions]
func WithCABundle ¶
func WithCABundle(caCertBytes []byte) containers.Option[Repository]
WithCABundle returns an option which configures the CA Bundle used for validating the TLS connection to the provided source.
func WithDefaultBranch ¶
func WithDefaultBranch(ref string) containers.Option[Repository]
WithDefaultBranch configures the default branch used to initially seed the repo, or base other branches on when they're not already present in the upstream.
func WithFilesystemStorage ¶
func WithFilesystemStorage(path string) containers.Option[Repository]
WithFilesystemStorage configures the Git repository to clone into the local filesystem, instead of the default which is in-memory. The provided path is location for the dotgit folder.
func WithForce ¶
func WithForce(vuo *ViewUpdateOptions)
func WithInsecureTLS ¶
func WithInsecureTLS(insecureSkipTLS bool) containers.Option[Repository]
WithInsecureTLS returns an option which configures the insecure TLS setting for the provided source.
func WithInterval ¶
func WithInterval(interval time.Duration) containers.Option[Repository]
WithInterval sets the period between automatic fetches from the upstream (if a remote is configured)
func WithMaxOpenDescriptors ¶
func WithMaxOpenDescriptors(n int) containers.Option[Repository]
WithMaxOpenDescriptors sets the maximum number of open file descriptors when using filesystem backed storage
func WithRemote ¶
func WithRemote(name, url string) containers.Option[Repository]
func WithRevision ¶
func WithRevision(rev plumbing.Hash) containers.Option[ViewUpdateOptions]
func WithSignature ¶
func WithSignature(name, email string) containers.Option[Repository]
WithSignature sets the default signature name and email when the signature cannot be derived from the request context.
Types ¶
type CreateBranchOptions ¶
type CreateBranchOptions struct {
// contains filtered or unexported fields
}
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(ctx context.Context, logger *slog.Logger, opts ...containers.Option[Repository]) (*Repository, error)
func (*Repository) Close ¶
func (r *Repository) Close() error
func (*Repository) CreateBranchIfNotExists ¶
func (r *Repository) CreateBranchIfNotExists(branch string, opts ...containers.Option[CreateBranchOptions]) error
func (*Repository) DefaultBranch ¶
func (r *Repository) DefaultBranch() string
func (*Repository) Fetch ¶
func (r *Repository) Fetch(ctx context.Context, specific ...string) (err error)
Fetch does a fetch for the requested head names on a configured remote. If the remote is not defined, then it is a silent noop. Iff specific is explicitly requested then only the heads in specific are fetched. Otherwise, it fetches all previously tracked head references.
func (*Repository) ListCommits ¶
func (*Repository) Subscribe ¶
func (r *Repository) Subscribe(sub Subscriber)
Subscribe registers the functions for the given branch name. It will be called each time the branch is updated while holding a lock.
func (*Repository) UpdateAndPush ¶
func (r *Repository) UpdateAndPush(ctx context.Context, fn func(fs fs.Filesystem) (string, error), opts ...containers.Option[ViewUpdateOptions]) (hash plumbing.Hash, err error)
func (*Repository) View ¶
func (r *Repository) View(ctx context.Context, fn func(hash plumbing.Hash, fs fs.Filesystem) error, opts ...containers.Option[ViewUpdateOptions]) (err error)
type Subscriber ¶
type ViewUpdateOptions ¶
type ViewUpdateOptions struct {
// contains filtered or unexported fields
}