aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/internal/common/common.go
diff options
context:
space:
mode:
authorAndrew Suffield <asuffield@gmail.com>2021-03-26 16:03:49 +0000
committerGitHub <noreply@github.com>2021-03-26 17:03:49 +0100
commite5bbc4d10904554dbc8fd5afd06f66814f7b173e (patch)
tree6a1508b51ede537c75896ba6650a8f5fb0ad09f8 /plumbing/transport/internal/common/common.go
parent1f328388192915476c68e5e0c8c1c818fd50fc6b (diff)
downloadgo-git-e5bbc4d10904554dbc8fd5afd06f66814f7b173e.tar.gz
plumbing: wire up contexts for Transport.AdvertisedReferences (#246)
* plumbing: wire up contexts for Transport.AdvertisedReferences * add more tests for context wiring
Diffstat (limited to 'plumbing/transport/internal/common/common.go')
-rw-r--r--plumbing/transport/internal/common/common.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/plumbing/transport/internal/common/common.go b/plumbing/transport/internal/common/common.go
index 89432e3..75405c7 100644
--- a/plumbing/transport/internal/common/common.go
+++ b/plumbing/transport/internal/common/common.go
@@ -162,14 +162,18 @@ func (c *client) listenFirstError(r io.Reader) chan string {
return errLine
}
-// AdvertisedReferences retrieves the advertised references from the server.
func (s *session) AdvertisedReferences() (*packp.AdvRefs, error) {
+ return s.AdvertisedReferencesContext(context.TODO())
+}
+
+// AdvertisedReferences retrieves the advertised references from the server.
+func (s *session) AdvertisedReferencesContext(ctx context.Context) (*packp.AdvRefs, error) {
if s.advRefs != nil {
return s.advRefs, nil
}
ar := packp.NewAdvRefs()
- if err := ar.Decode(s.Stdout); err != nil {
+ if err := ar.Decode(s.StdoutContext(ctx)); err != nil {
if err := s.handleAdvRefDecodeError(err); err != nil {
return nil, err
}
@@ -237,7 +241,7 @@ func (s *session) UploadPack(ctx context.Context, req *packp.UploadPackRequest)
return nil, err
}
- if _, err := s.AdvertisedReferences(); err != nil {
+ if _, err := s.AdvertisedReferencesContext(ctx); err != nil {
return nil, err
}