aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/common.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-12-08 14:24:25 +0100
committerGitHub <noreply@github.com>2016-12-08 14:24:25 +0100
commit7d9d9bfee34ea428a127da0df900d3a26de37c38 (patch)
tree225c5661c6be1a000c2e5cc15961c214040c7cff /plumbing/transport/common.go
parent3962b8d4dbb2d2d61e9282d73f8d3d0f2a222461 (diff)
downloadgo-git-7d9d9bfee34ea428a127da0df900d3a26de37c38.tar.gz
plumbing/transport: allow AdvertisedReferences being called multiple times. (#165)
* AdvertisedReferences is now part of transport.Session. * It is allowed to be called more than once. * It is allowed to be called before and after FetchPack/SendPack. * Implementations cache its result.
Diffstat (limited to 'plumbing/transport/common.go')
-rw-r--r--plumbing/transport/common.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go
index a20fa14..41813bf 100644
--- a/plumbing/transport/common.go
+++ b/plumbing/transport/common.go
@@ -30,8 +30,6 @@ var (
ErrAuthorizationRequired = errors.New("authorization required")
ErrEmptyUploadPackRequest = errors.New("empty git-upload-pack given")
ErrInvalidAuthMethod = errors.New("invalid auth method")
-
- ErrAdvertistedReferencesAlreadyCalled = errors.New("cannot call AdvertisedReference twice")
)
const (
@@ -49,6 +47,9 @@ type Client interface {
type Session interface {
SetAuth(auth AuthMethod) error
+ // AdvertisedReferences retrieves the advertised references for a
+ // repository.
+ AdvertisedReferences() (*packp.AdvRefs, error)
io.Closer
}
@@ -63,10 +64,6 @@ type AuthMethod interface {
// In that order.
type FetchPackSession interface {
Session
- // AdvertisedReferences retrieves the advertised references for a
- // repository. It should be called before FetchPack, and it cannot be
- // called after FetchPack.
- AdvertisedReferences() (*packp.AdvRefs, error)
// FetchPack takes a request and returns a reader for the packfile
// received from the server.
FetchPack(*packp.UploadPackRequest) (*packp.UploadPackResponse, error)
@@ -78,10 +75,6 @@ type FetchPackSession interface {
// In that order.
type SendPackSession interface {
Session
- // AdvertisedReferences retrieves the advertised references for a
- // repository. It should be called before FetchPack, and it cannot be
- // called after FetchPack.
- AdvertisedReferences() (*packp.AdvRefs, error)
// UpdateReferences sends an update references request and returns a
// writer to be used for packfile writing.
//TODO: Complete signature.