common

package
v4.0.0-rc5+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package common implements the git pack protocol with a pluggable transport. This is a low-level package to implement new transports. Use a concrete implementation instead (e.g. http, file, ssh).

A simple example of usage can be found in the file package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeoutExceeded = errors.New("timeout exceeded")
)

Functions

func DecodeUploadPackResponse

func DecodeUploadPackResponse(r io.ReadCloser, req *packp.UploadPackRequest) (
	*packp.UploadPackResponse, error,
)

DecodeUploadPackResponse decodes r into a new packp.UploadPackResponse

func NewClient

func NewClient(runner Commander) transport.Client

NewClient creates a new client using the given Commander.

Types

type Command

type Command interface {
	// SetAuth sets the authentication method.
	SetAuth(transport.AuthMethod) error
	// StderrPipe returns a pipe that will be connected to the command's
	// standard error when the command starts. It should not be called after
	// Start.
	StderrPipe() (io.Reader, error)
	// StdinPipe returns a pipe that will be connected to the command's
	// standard input when the command starts. It should not be called after
	// Start. The pipe should be closed when no more input is expected.
	StdinPipe() (io.WriteCloser, error)
	// StdoutPipe returns a pipe that will be connected to the command's
	// standard output when the command starts. It should not be called after
	// Start.
	StdoutPipe() (io.Reader, error)
	// Start starts the specified command. It does not wait for it to
	// complete.
	Start() error
	// Wait waits for the command to exit. It must have been started by
	// Start. The returned error is nil if the command runs, has no
	// problems copying stdin, stdout, and stderr, and exits with a zero
	// exit status.
	Wait() error
	// Close closes the command and releases any resources used by it. It
	// can be called to forcibly finish the command without calling to Wait
	// or to release resources after calling Wait.
	Close() error
}

Command is used for a single command execution. This interface is modeled after exec.Cmd and ssh.Session in the standard library.

type Commander

type Commander interface {
	// Command creates a new Command for the given git command and
	// endpoint. cmd can be git-upload-pack or git-receive-pack. An
	// error should be returned if the endpoint is not supported or the
	// command cannot be created (e.g. binary does not exist, connection
	// cannot be established).
	Command(cmd string, ep transport.Endpoint) (Command, error)
}

Commander creates Command instances. This is the main entry point for transport implementations.

Jump to

Keyboard shortcuts

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