gitserver

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package gitserver provides a read-only smart HTTP Git server.

Index

Constants

This section is empty.

Variables

View Source
var ErrGit = errors.New("git cannot be run")

ErrGit is returned by New when the git command cannot be run.

Functions

This section is empty.

Types

type Server

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

Server represents a Git server.

func New

func New() (*Server, error)

New creates a git server, but doesn't start it.

func (*Server) AddPath

func (srv *Server) AddPath(path string) (string, error)

AddPath adds a file path to the Git server. The path is served as a Git repository with a single commit. It returns the name of the new served repository.

func (*Server) AddRepository

func (srv *Server) AddRepository(path string) (string, error)

AddRepository adds a repository to the Git server. It returns the name of the new served repository.

func (*Server) Close

func (srv *Server) Close() error

Close stops the server and deletes any temporary directory created to store the repositories.

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe(addr string) error

ListenAndServe listens on the TCP network address addr and then calls [*GitServer.Serve] to handle requests on incoming connections.

ListenAndServe always returns a non-nil error.

func (*Server) Serve

func (srv *Server) Serve(l net.Listener) error

Serve accepts incoming connections on the http.Listener l.

Serve always returns a non-nil error and closes l.

Directories

Path Synopsis
Package gittest provides utilities for Git testing.
Package gittest provides utilities for Git testing.

Jump to

Keyboard shortcuts

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