Documentation ¶
Index ¶
- Variables
- func EnsureDefaultBranch(ctx context.Context, repoPath string) error
- func EnsureWithin(reposDir string, repo string) error
- func LFSAuthenticate(ctx context.Context, cmd ServiceCommand) error
- func LFSTransfer(ctx context.Context, cmd ServiceCommand) error
- func ReceivePack(ctx context.Context, cmd ServiceCommand) error
- func UploadArchive(ctx context.Context, cmd ServiceCommand) error
- func UploadPack(ctx context.Context, cmd ServiceCommand) error
- func WritePktline(w io.Writer, v ...interface{}) error
- func WritePktlineErr(w io.Writer, err error) error
- type LFSLock
- type Service
- type ServiceCommand
- type ServiceHandler
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotAuthed represents unauthorized access. ErrNotAuthed = errors.New("you are not authorized to do this") // ErrSystemMalfunction represents a general system error returned to clients. ErrSystemMalfunction = errors.New("something went wrong") // ErrInvalidRepo represents an attempt to access a non-existent repo. ErrInvalidRepo = errors.New("invalid repo") // ErrInvalidRequest represents an invalid request. ErrInvalidRequest = errors.New("invalid request") // ErrMaxConnections represents a maximum connection limit being reached. ErrMaxConnections = errors.New("too many connections, try again later") // ErrTimeout is returned when the maximum read timeout is exceeded. ErrTimeout = errors.New("I/O timeout reached") )
var ErrNoBranches = errors.New("no branches found")
ErrNoBranches is returned when a repo has no branches.
Functions ¶
func EnsureDefaultBranch ¶
EnsureDefaultBranch ensures the repo has a default branch. It will prefer choosing "main" or "master" if available.
func EnsureWithin ¶
EnsureWithin ensures the given repo is within the repos directory.
func LFSAuthenticate ¶
func LFSAuthenticate(ctx context.Context, cmd ServiceCommand) error
LFSAuthenticate implements teh Git LFS SSH authentication command. Context must have *config.Config, *log.Logger, proto.User. cmd.Args should have the repo path and operation as arguments.
func LFSTransfer ¶
func LFSTransfer(ctx context.Context, cmd ServiceCommand) error
LFSTransfer is a Git LFS transfer service handler. ctx is expected to have proto.User, *backend.Backend, *log.Logger, *config.Config, *db.DB, and store.Store. The first arg in cmd.Args should be the repo path. The second arg in cmd.Args should be the LFS operation (download or upload).
func ReceivePack ¶
func ReceivePack(ctx context.Context, cmd ServiceCommand) error
ReceivePack runs the git receive-pack protocol against the provided repo.
func UploadArchive ¶
func UploadArchive(ctx context.Context, cmd ServiceCommand) error
UploadArchive runs the git upload-archive protocol against the provided repo.
func UploadPack ¶
func UploadPack(ctx context.Context, cmd ServiceCommand) error
UploadPack runs the git upload-pack protocol against the provided repo.
func WritePktline ¶
WritePktline encodes and writes a pktline to the given writer.
Types ¶
type LFSLock ¶
type LFSLock struct {
// contains filtered or unexported fields
}
LFSLock is a Git LFS lock object. It implements transfer.Lock.
func (*LFSLock) AsArguments ¶
AsArguments implements transfer.Lock.
func (*LFSLock) AsLockSpec ¶
AsLockSpec implements transfer.Lock.
func (*LFSLock) FormattedTimestamp ¶
FormattedTimestamp implements transfer.Lock.
type Service ¶
type Service string
Service is a Git daemon service.
const ( // UploadPackService is the upload-pack service. UploadPackService Service = "git-upload-pack" // UploadArchiveService is the upload-archive service. UploadArchiveService Service = "git-upload-archive" // ReceivePackService is the receive-pack service. ReceivePackService Service = "git-receive-pack" // LFSTransferService is the LFS transfer service. LFSTransferService Service = "git-lfs-transfer" // LFSAuthenticateService is the LFS authenticate service. LFSAuthenticateService = "git-lfs-authenticate" )
type ServiceCommand ¶
type ServiceCommand struct { Stdin io.Reader Stdout io.Writer Stderr io.Writer Dir string Env []string Args []string // Modifier functions CmdFunc func(*exec.Cmd) }
ServiceCommand is used to run a git service command.
type ServiceHandler ¶
type ServiceHandler func(ctx context.Context, cmd ServiceCommand) error
ServiceHandler is a git service command handler.