From a48bc6e17ef6298f93ec21cdf1a5e387640673b6 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Mon, 30 Jan 2017 14:42:19 +0100 Subject: Repository.Progress moved as a field in *Options (#237) --- plumbing/protocol/packp/sideband/demux.go | 3 +-- plumbing/protocol/packp/sideband/demux_test.go | 11 ++++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'plumbing') diff --git a/plumbing/protocol/packp/sideband/demux.go b/plumbing/protocol/packp/sideband/demux.go index 6470380..e16c497 100644 --- a/plumbing/protocol/packp/sideband/demux.go +++ b/plumbing/protocol/packp/sideband/demux.go @@ -11,9 +11,8 @@ import ( // ErrMaxPackedExceeded returned by Read, if the maximum packed size is exceeded var ErrMaxPackedExceeded = errors.New("max. packed size exceeded") -// Progress allows to read the progress information +// Progress where the progress information is stored type Progress interface { - io.Reader io.Writer } diff --git a/plumbing/protocol/packp/sideband/demux_test.go b/plumbing/protocol/packp/sideband/demux_test.go index ee5f19a..3d2d6ed 100644 --- a/plumbing/protocol/packp/sideband/demux_test.go +++ b/plumbing/protocol/packp/sideband/demux_test.go @@ -84,23 +84,24 @@ func (s *SidebandSuite) TestDecodeFromFailingReader(c *C) { func (s *SidebandSuite) TestDecodeWithProgress(c *C) { expected := []byte("abcdefghijklmnopqrstuvwxyz") - buf := bytes.NewBuffer(nil) - e := pktline.NewEncoder(buf) + input := bytes.NewBuffer(nil) + e := pktline.NewEncoder(input) e.Encode(PackData.WithPayload(expected[0:8])) e.Encode(ProgressMessage.WithPayload([]byte{'F', 'O', 'O', '\n'})) e.Encode(PackData.WithPayload(expected[8:16])) e.Encode(PackData.WithPayload(expected[16:26])) + output := bytes.NewBuffer(nil) content := make([]byte, 26) - d := NewDemuxer(Sideband64k, buf) - d.Progress = bytes.NewBuffer(nil) + d := NewDemuxer(Sideband64k, input) + d.Progress = output n, err := io.ReadFull(d, content) c.Assert(err, IsNil) c.Assert(n, Equals, 26) c.Assert(content, DeepEquals, expected) - progress, err := ioutil.ReadAll(d.Progress) + progress, err := ioutil.ReadAll(output) c.Assert(err, IsNil) c.Assert(progress, DeepEquals, []byte{'F', 'O', 'O', '\n'}) } -- cgit