Back to godoc.org
agola.io/agola / internal / git-handler

Package githandler

v0.5.0
Latest Go to latest

The latest major version is .

Published: Feb 18, 2020 | License: Apache-2.0 | Module: agola.io/agola

Index

Variables

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/(.+?)/(.+)`)
)
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
	RequestTypeUploadPack
	RequestTypeReceivePack
)

func MatchPath

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

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier