transport

package
v4.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 8 Imported by: 2,161

Documentation

Overview

Package transport includes the implementation for different transport protocols.

`Client` can be used to fetch and send packfiles to a git server. The `client` package provides higher level functions to instantiate the appropriate `Client` based on the repository URL.

go-git supports HTTP and SSH (see `Protocols`), but you can also install your own protocols (see the `client` package).

Each protocol has its own implementation of `Client`, but you should generally not use them directly, use `client.NewClient` instead.

Index

Constants

View Source
const (
	UploadPackServiceName  = "git-upload-pack"
	ReceivePackServiceName = "git-receive-pack"
)

Variables

View Source
var (
	ErrRepositoryNotFound     = errors.New("repository not found")
	ErrEmptyRemoteRepository  = errors.New("remote repository is empty")
	ErrAuthorizationRequired  = errors.New("authorization required")
	ErrEmptyUploadPackRequest = errors.New("empty git-upload-pack given")
	ErrInvalidAuthMethod      = errors.New("invalid auth method")
)

UnsupportedCapabilities are the capabilities not supported by any client implementation

Functions

func FilterUnsupportedCapabilities

func FilterUnsupportedCapabilities(list *capability.List)

FilterUnsupportedCapabilities it filter out all the UnsupportedCapabilities from a capability.List, the intended usage is on the client implementation to filter the capabilities from an AdvRefs message.

Types

type AuthMethod

type AuthMethod interface {
	fmt.Stringer
	Name() string
}

type Client

type Client interface {
	// NewFetchPackSession starts a git-fetch-pack session for an endpoint.
	NewFetchPackSession(Endpoint) (FetchPackSession, error)
	// NewSendPackSession starts a git-send-pack session for an endpoint.
	NewSendPackSession(Endpoint) (SendPackSession, error)
}

Client can initiate git-fetch-pack and git-send-pack processes.

type Endpoint

type Endpoint url.URL

func NewEndpoint

func NewEndpoint(endpoint string) (Endpoint, error)

func (*Endpoint) String

func (e *Endpoint) String() string

type FetchPackSession

type FetchPackSession interface {
	Session
	// FetchPack takes a request and returns a reader for the packfile
	// received from the server.
	FetchPack(*packp.UploadPackRequest) (*packp.UploadPackResponse, error)
}

FetchPackSession represents a git-fetch-pack session. A git-fetch-pack session has two steps: reference discovery (`AdvertisedReferences` function) and fetching pack (`FetchPack` function). In that order.

type SendPackSession

type SendPackSession interface {
	Session
	// UpdateReferences sends an update references request and a packfile
	// reader and returns a ReportStatus and error.
	SendPack(*packp.ReferenceUpdateRequest) (*packp.ReportStatus, error)
}

SendPackSession represents a git-send-pack session. A git-send-pack session has two steps: reference discovery (`AdvertisedReferences` function) and sending pack (`SendPack` function). In that order.

type Session

type Session interface {
	SetAuth(auth AuthMethod) error
	// AdvertisedReferences retrieves the advertised references for a
	// repository.
	// If the repository does not exist, returns ErrRepositoryNotFound.
	// If the repository exists, but is empty, returns ErrEmptyRemoteRepository.
	AdvertisedReferences() (*packp.AdvRefs, error)
	io.Closer
}

Directories

Path Synopsis
Package http implements a HTTP client for go-git.
Package http implements a HTTP client for go-git.
internal
common
Package common implements the git pack protocol with a pluggable transport.
Package common implements the git pack protocol with a pluggable transport.
Package test implements common test suite for different transport implementations.
Package test implements common test suite for different transport implementations.

Jump to

Keyboard shortcuts

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