git

package
v0.0.1-prerelease9 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyCommit = errors.New("empty commit")

Functions

func WithAuth

WithAuth returns an option which configures the auth method used by the provided source.

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 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 (r *Repository) ListCommits(ctx context.Context, branch, from string, filter func(string) bool) (_ iter.Seq[*object.Commit], err error)

func (*Repository) Resolve

func (r *Repository) Resolve(branch string) (plumbing.Hash, error)

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 Subscriber interface {
	Branches() []string
	Notify(ctx context.Context, refs map[string]string) error
}

type ViewUpdateOptions

type ViewUpdateOptions struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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