diff options
author | Andrew Suffield <asuffield@gmail.com> | 2021-03-26 16:03:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 17:03:49 +0100 |
commit | e5bbc4d10904554dbc8fd5afd06f66814f7b173e (patch) | |
tree | 6a1508b51ede537c75896ba6650a8f5fb0ad09f8 /plumbing/transport/internal/common/common.go | |
parent | 1f328388192915476c68e5e0c8c1c818fd50fc6b (diff) | |
download | go-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.go | 10 |
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 } |