Documentation
¶
Overview ¶
Package testutils provides utility functions for building testdata.
Index ¶
- type RepoBuilder
- func (b *RepoBuilder) CreateBranch(branchName string, commit plumbing.Hash) (*plumbing.Reference, error)
- func (b *RepoBuilder) CreateRandomCommit(size int64) (plumbing.Hash, error)
- func (b *RepoBuilder) CreateTag(tagName string, commit plumbing.Hash) (*plumbing.Reference, error)
- func (b *RepoBuilder) DeleteBranch(branchName string) error
- func (b *RepoBuilder) DeleteTag(tagName string) error
- func (b *RepoBuilder) Repo() *git.Repository
- type RequestSender
- type RequestSenderLFS
- type ResponseReceiver
- type ResponseReceiverLFS
- type ReverseCommunicator
- type ReverseCommunicatorLFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RepoBuilder ¶
type RepoBuilder struct {
// contains filtered or unexported fields
}
RepoBuilder provides methods for building a git repository.
func NewRepoBuilder ¶
func NewRepoBuilder(dir string) (*RepoBuilder, error)
NewRepoBuilder initializes a RepoBuilder.
func (*RepoBuilder) CreateBranch ¶
func (b *RepoBuilder) CreateBranch(branchName string, commit plumbing.Hash) (*plumbing.Reference, error)
CreateBranch creates a new branch.
func (*RepoBuilder) CreateRandomCommit ¶
func (b *RepoBuilder) CreateRandomCommit(size int64) (plumbing.Hash, error)
CreateRandomCommit creates a commit with random file data of given size.
func (*RepoBuilder) DeleteBranch ¶
func (b *RepoBuilder) DeleteBranch(branchName string) error
DeleteBranch deletes a branch.
func (*RepoBuilder) DeleteTag ¶
func (b *RepoBuilder) DeleteTag(tagName string) error
DeleteTag deletes a tag.
func (*RepoBuilder) Repo ¶
func (b *RepoBuilder) Repo() *git.Repository
Repo returns the underlying git repository.
type RequestSender ¶
type RequestSender interface {
// SendCapabilitiesRequest sends a [git.CapabilitiesRequest].
SendCapabilitiesRequest() error
// SendOptionRequest sends a [git.OptionRequest].
SendOptionRequest(opt git.Option, value string) error
// SendListRequest sends a [git.ListRequest].
SendListRequest(forPush bool) error
// SendPushRequestBatch sends a batch of [git.PushRequest]s.
//
// Prepend a "+" to a src ref for a force push.
SendPushRequestBatch(refs map[string]string) error
// SendFetchRequestBatch sends a batch of [git.FetchRequest]s.
SendFetchRequestBatch(refs []plumbing.Reference) error
}
RequestSender provides methods for sending requests.
type RequestSenderLFS ¶
type RequestSenderLFS interface {
// SendInitRequest sends an [lfs.InitRequest].
SendInitRequest(op lfs.Operation, remote string) error
// SendTransferUploadRequest sends an [lfs.TransferRequest] with event
// [lfs.UploadEvent].
SendTransferUploadRequest(oid string, size int64, path string) error
// SendTransferDownloadRequest sends an [lfs.TransferRequest] with event
// [lfs.DownloadEvent].
SendTransferDownloadRequest(oid string, size int64) error
// SendTerminateRequest sends an [lfs.TransferRequest] with event
// [lfs.TerminateEvent].
SendTerminateRequest() error
}
RequestSenderLFS provides methods for sending requests.
type ResponseReceiver ¶
type ResponseReceiver interface {
// ReceiveCapabilitiesResponse receives a response to a [git.CapabilitiesRequest].
ReceiveCapabilitiesResponse() error
// ReceiveOptionResponse receives a response to a [git.OptionRequest].
ReceiveOptionResponse() error
// ReceiveListResponse receives a response to a [git.ListRequest].
ReceiveListResponse() error
// ReceivePushResponse receives a batch of responses to a batch of [git.PushRequest]s.
ReceivePushResponseBatch() error
// ReceiveFetchResponse receives a response to a batch of [git.FetchRequest]s.
ReceiveFetchResponse() error
}
ResponseReceiver provides methods for receiving and parsing responses.
type ResponseReceiverLFS ¶
type ResponseReceiverLFS interface {
// ReceiveInitResponse receives an [lfs.InitResponse].
ReceiveInitResponse() error
// ReceiveProgressResponse receives an [lfs.ProgressResponse].
ReceiveProgressResponse() error
// ReceiveTransferResponse receives an [lfs.TransferResponse].
ReceiveTransferResponse(responseTo lfs.Event) error
}
ResponseReceiverLFS provides methods for receiving and parsing responses.
type ReverseCommunicator ¶
type ReverseCommunicator interface {
RequestSender
ResponseReceiver
}
ReverseCommunicator is the reverse of git comms.Communicator, acting as Git sending remote helper protocol requests and receiving responses.
func NewReverseCommunicator ¶
func NewReverseCommunicator(in io.Reader, out io.Writer) ReverseCommunicator
NewReverseCommunicator initializes a ReverseCommunicator.
type ReverseCommunicatorLFS ¶
type ReverseCommunicatorLFS interface {
RequestSenderLFS
ResponseReceiverLFS
}
ReverseCommunicatorLFS is the reverse of lfs comms.Communicator, acting as git-lfs sending custom transfer protocol requests and receiving responses.
In addition to regular errors, methods return errors if the underlying message contains an error.
func NewReverseCommunicatorLFS ¶
func NewReverseCommunicatorLFS(in io.Reader, out io.Writer) ReverseCommunicatorLFS
NewReverseCommunicatorLFS initializes a ReverseCommunicatorLFS.