gittest

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGitServer

func CreateGitServer(t *testing.T, opts Options) *httptest.Server

CreateGitServer creates a git repository with an in-memory filesystem and serves it over HTTP using a httptest.Server.

func NewRepo

func NewRepo(t *testing.T, fs billy.Filesystem, commits ...CommitFunc) *git.Repository

NewRepo returns a new Git repository.

func NewServer

func NewServer(fs billy.Filesystem) http.Handler

NewServer returns a http.Handler that serves a git repository. It's expected that the repository is already initialized by the caller.

func NewServerSSH

func NewServerSSH(t *testing.T, fs billy.Filesystem, pubkeys ...gossh.PublicKey) *transport.Endpoint

func WriteFile

func WriteFile(t *testing.T, fs billy.Filesystem, path, content string)

WriteFile writes a file to the filesystem.

Types

type CommitFunc

type CommitFunc func(billy.Filesystem, *git.Repository)

CommitFunc commits to a repo.

func Commit

func Commit(t *testing.T, path, content, msg string) CommitFunc

Commit is a test helper for committing a single file to a repo.

type Options

type Options struct {
	Files    map[string]string
	Username string
	Password string
	AuthMW   func(http.Handler) http.Handler
	TLS      bool
}

Jump to

Keyboard shortcuts

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