diff options
Diffstat (limited to 'plumbing/transport/http')
-rw-r--r-- | plumbing/transport/http/common.go | 2 | ||||
-rw-r--r-- | plumbing/transport/http/fetch_pack.go | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/plumbing/transport/http/common.go b/plumbing/transport/http/common.go index a1b085b..aa3425e 100644 --- a/plumbing/transport/http/common.go +++ b/plumbing/transport/http/common.go @@ -6,6 +6,7 @@ import ( "net/http" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" "gopkg.in/src-d/go-git.v4/plumbing/transport" ) @@ -50,6 +51,7 @@ type session struct { auth AuthMethod client *http.Client endpoint transport.Endpoint + advRefs *packp.AdvRefs } func (s *session) SetAuth(auth transport.AuthMethod) error { diff --git a/plumbing/transport/http/fetch_pack.go b/plumbing/transport/http/fetch_pack.go index 1548110..0c85be4 100644 --- a/plumbing/transport/http/fetch_pack.go +++ b/plumbing/transport/http/fetch_pack.go @@ -17,7 +17,6 @@ import ( type fetchPackSession struct { *session - advRefsRun bool } func newFetchPackSession(c *http.Client, @@ -33,12 +32,10 @@ func newFetchPackSession(c *http.Client, } func (s *fetchPackSession) AdvertisedReferences() (*packp.AdvRefs, error) { - if s.advRefsRun { - return nil, transport.ErrAdvertistedReferencesAlreadyCalled + if s.advRefs != nil { + return s.advRefs, nil } - defer func() { s.advRefsRun = true }() - url := fmt.Sprintf( "%s/info/refs?service=%s", s.endpoint.String(), transport.UploadPackServiceName, @@ -72,6 +69,7 @@ func (s *fetchPackSession) AdvertisedReferences() (*packp.AdvRefs, error) { } transport.FilterUnsupportedCapabilities(ar.Capabilities) + s.advRefs = ar return ar, nil } |