This section is empty.


View Source
var (
	InfoRefsRegExp    = regexp.MustCompile(`/(.+\.git)/info/refs$`)
	UploadPackRegExp  = regexp.MustCompile(`/(.+\.git)/git-upload-pack$`)
	ReceivePackRegExp = regexp.MustCompile(`/(.+\.git)/git-receive-pack$`)

	FetchFileRegExp = regexp.MustCompile(`/(.+\.git)/raw/(.+?)/(.+)`)
View Source
var ErrWrongRepoPath = errors.New("wrong repository path")


func InfoRefsResponse

func InfoRefsResponse(ctx context.Context, repoPath, serviceName string) ([]byte, error)


type FetchFileData

type FetchFileData struct {
	RepoPath string
	Ref      string
	Path     string

func ParseFetchFilePath

func ParseFetchFilePath(path string) (*FetchFileData, error)

type FetchFileHandler

type FetchFileHandler struct {

	// contains filtered or unexported fields


func NewFetchFileHandler

func NewFetchFileHandler(logger *zap.Logger, reposDir string, repoAbsPathFunc RepoAbsPathFunc) *FetchFileHandler

func (*FetchFileHandler) ServeHTTP

func (h *FetchFileHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GitSmartHandler

type GitSmartHandler struct {

	// contains filtered or unexported fields


func NewGitSmartHandler

func NewGitSmartHandler(logger *zap.Logger, reposDir string, createRepo bool, repoAbsPathFunc RepoAbsPathFunc, repoPostCreateFunc RepoPostCreateFunc) *GitSmartHandler

func (*GitSmartHandler) ServeHTTP

func (h *GitSmartHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RepoAbsPathFunc

type RepoAbsPathFunc func(reposDir, path string) (absPath string, exists bool, err error)

RepoAbsPathFunc is a user defined functions that, given the repo path provided in the url request, will return the file system absolute repo path and if it exists. This function should also do path validation and return ErrWrongRepoPath if path validation failed.

type RepoPostCreateFunc

type RepoPostCreateFunc func(repoPath, repoAbsPath string) error

type RequestType

type RequestType int
const (
	RequestTypeInfoRefs RequestType = iota

func MatchPath

func MatchPath(path string) (string, RequestType, error)

Source Files