Documentation
¶
Overview ¶
Package testgitserver provides a local Git HTTP server for testing using git-http-backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a local Git HTTP server using git http-backend.
func NewServer ¶
NewServer creates a new local Git HTTP server for testing. repoRoot is the directory containing Git repositories. This creates an httptest.Server for use in tests.
func NewServerWithoutHTTP ¶
NewServerWithoutHTTP creates a Server without starting an httptest.Server. This is useful when you want to use the handler with your own HTTP server.
type TestRepo ¶
type TestRepo struct {
Path string
RepoURL string // URL path (e.g., "/test/repo.git")
Commits []string
}
TestRepo represents a test Git repository with known commits.
func CreateTestRepo ¶
CreateTestRepo creates a Git repository with a specified number of commits. The repository will be created at repoRoot/repoPath. Returns the commit SHAs in chronological order (oldest first).
func (*TestRepo) MainCommit ¶
MainCommit returns the latest (main) commit SHA.
func (*TestRepo) OlderCommit ¶
OlderCommit returns an older commit SHA (5th from the end if available).
func (*TestRepo) PrevCommit ¶
PrevCommit returns the second-to-last commit SHA.