git

package
v0.0.0-...-b8c384c Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: Apache-2.0 Imports: 40 Imported by: 2

Documentation

Overview

Git Repository Adapter

Index

Constants

View Source
const (
	Main plumbing.ReferenceName = "refs/heads/main"
)

Variables

This section is empty.

Functions

func InitEmptyRepositoryWithWorktree

func InitEmptyRepositoryWithWorktree(t *testing.T, path string) *gogit.Repository

func OpenGitRepositoryFromArchive

func OpenGitRepositoryFromArchive(t *testing.T, tarfile, tempdir string) *gogit.Repository

func OpenGitRepositoryFromArchiveWithWorktree

func OpenGitRepositoryFromArchiveWithWorktree(t *testing.T, tarfile, path string) *gogit.Repository

func ServeGitRepository

func ServeGitRepository(t *testing.T, tarfile, tempdir string) (*gogit.Repository, string)

func TestDataAbs

func TestDataAbs(t *testing.T, rel string) string

Types

type GitHash

type GitHash = plumbing.Hash

type GitRepository

type GitRepository interface {
	repository.Repository
	GetPackage(ref, path string) (repository.PackageRevision, kptfilev1.GitLock, error)
}

func OpenRepository

func OpenRepository(ctx context.Context, name, namespace string, spec *configapi.GitRepository, root string, opts GitRepositoryOptions) (GitRepository, error)

type GitRepositoryOptions

type GitRepositoryOptions struct {
	CredentialResolver repository.CredentialResolver
	UserInfoProvider   repository.UserInfoProvider
}

type GitServer

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

GitServer is a mock git server implementing "just enough" of the git protocol

func NewGitServer

func NewGitServer(repo *gogit.Repository, opts ...GitServerOption) (*GitServer, error)

NewGitServer constructs a GitServer backed by the specified repo.

func (*GitServer) ListenAndServe

func (s *GitServer) ListenAndServe(ctx context.Context, listen string, addressChannel chan<- net.Addr) error

ListenAndServe starts the git server on "listen". The address we actually start listening on will be posted to addressChannel

func (*GitServer) ServeHTTP

func (s *GitServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP is the entrypoint for http requests.

type GitServerOption

type GitServerOption interface {
	// contains filtered or unexported methods
}

func WithBasicAuth

func WithBasicAuth(username, password string) GitServerOption

type PacketLineWriter

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

PacketLineWriter implements the git protocol line framing, with deferred error handling.

func NewPacketLineWriter

func NewPacketLineWriter(w io.Writer) *PacketLineWriter

NewPackageLineWriter constructs a PacketLineWriter

func (*PacketLineWriter) Flush

func (w *PacketLineWriter) Flush() error

Flush writes any buffered data, and returns an error if one has accumulated.

func (*PacketLineWriter) WriteLine

func (w *PacketLineWriter) WriteLine(s string)

WriteLine frames and writes a line, accumulating errors until Flush is called.

func (*PacketLineWriter) WriteZeroPacketLine

func (w *PacketLineWriter) WriteZeroPacketLine()

WriteZeroPacketLine writes a special "0000" line - often used to indicate the end of a block in the git protocol

type RefUpdate

type RefUpdate struct {
	From GitHash
	To   GitHash
	Ref  string
}

RefUpdate stores requested tag/branch updates

Jump to

Keyboard shortcuts

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