testgit

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package testgit runs an in-process git host for one bare repository: smart HTTP (git http-backend over net/http/cgi) behind a basic-auth token, and SSH (git upload-pack / receive-pack) behind one deploy key. It needs the git CLI and no Docker.

Index

Constants

View Source
const Base = "main"

Base is the branch Start seeds.

Variables

This section is empty.

Functions

func Run

func Run(t testing.TB, dir string, args ...string) string

Run runs git in dir with a fixed identity and no user or system config, and returns its trimmed output.

Types

type Server

type Server struct {
	// HTTPURL accepts basic auth with any user and Token as the password.
	HTTPURL string
	Token   string
	// SSHURL accepts KeyPEM; KnownHosts pins the server host key.
	SSHURL     string
	KeyPEM     []byte
	KnownHosts []byte
	// contains filtered or unexported fields
}

Server is one seeded bare repository served over HTTP and SSH.

func Start

func Start(t testing.TB, files map[string]string) *Server

Start seeds files (path → content) as one commit on Base and serves it. It fails the test when the git CLI is not installed.

Jump to

Keyboard shortcuts

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