aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/protocol')
-rw-r--r--plumbing/protocol/packp/sideband/demux_test.go3
-rw-r--r--plumbing/protocol/packp/updreq_decode.go3
-rw-r--r--plumbing/protocol/packp/updreq_decode_test.go15
-rw-r--r--plumbing/protocol/packp/updreq_encode_test.go5
-rw-r--r--plumbing/protocol/packp/uppackresp_test.go20
5 files changed, 21 insertions, 25 deletions
diff --git a/plumbing/protocol/packp/sideband/demux_test.go b/plumbing/protocol/packp/sideband/demux_test.go
index 6cda703..8f23353 100644
--- a/plumbing/protocol/packp/sideband/demux_test.go
+++ b/plumbing/protocol/packp/sideband/demux_test.go
@@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"io"
- "io/ioutil"
"testing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -101,7 +100,7 @@ func (s *SidebandSuite) TestDecodeWithProgress(c *C) {
c.Assert(n, Equals, 26)
c.Assert(content, DeepEquals, expected)
- progress, err := ioutil.ReadAll(output)
+ progress, err := io.ReadAll(output)
c.Assert(err, IsNil)
c.Assert(progress, DeepEquals, []byte{'F', 'O', 'O', '\n'})
}
diff --git a/plumbing/protocol/packp/updreq_decode.go b/plumbing/protocol/packp/updreq_decode.go
index 2c9843a..076de54 100644
--- a/plumbing/protocol/packp/updreq_decode.go
+++ b/plumbing/protocol/packp/updreq_decode.go
@@ -6,7 +6,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -81,7 +80,7 @@ func (req *ReferenceUpdateRequest) Decode(r io.Reader) error {
var ok bool
rc, ok = r.(io.ReadCloser)
if !ok {
- rc = ioutil.NopCloser(r)
+ rc = io.NopCloser(r)
}
d := &updReqDecoder{r: rc, s: pktline.NewScanner(r)}
diff --git a/plumbing/protocol/packp/updreq_decode_test.go b/plumbing/protocol/packp/updreq_decode_test.go
index 2630112..bdcbdf5 100644
--- a/plumbing/protocol/packp/updreq_decode_test.go
+++ b/plumbing/protocol/packp/updreq_decode_test.go
@@ -3,7 +3,6 @@ package packp
import (
"bytes"
"io"
- "io/ioutil"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
@@ -157,7 +156,7 @@ func (s *UpdReqDecodeSuite) TestOneUpdateCommand(c *C) {
expected.Commands = []*Command{
{Name: name, Old: hash1, New: hash2},
}
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00",
@@ -177,7 +176,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommands(c *C) {
{Name: plumbing.ReferenceName("myref2"), Old: plumbing.ZeroHash, New: hash2},
{Name: plumbing.ReferenceName("myref3"), Old: hash1, New: plumbing.ZeroHash},
}
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref1\x00",
@@ -200,7 +199,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommandsAndCapabilities(c *C) {
{Name: plumbing.ReferenceName("myref3"), Old: hash1, New: plumbing.ZeroHash},
}
expected.Capabilities.Add("shallow")
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref1\x00shallow",
@@ -224,7 +223,7 @@ func (s *UpdReqDecodeSuite) TestMultipleCommandsAndCapabilitiesShallow(c *C) {
}
expected.Capabilities.Add("shallow")
expected.Shallow = &hash1
- expected.Packfile = ioutil.NopCloser(bytes.NewReader([]byte{}))
+ expected.Packfile = io.NopCloser(bytes.NewReader([]byte{}))
payloads := []string{
"shallow 1ecf0ef2c2dffb796033e5a02219af86ec6584e5",
@@ -247,7 +246,7 @@ func (s *UpdReqDecodeSuite) TestWithPackfile(c *C) {
{Name: name, Old: hash1, New: hash2},
}
packfileContent := []byte("PACKabc")
- expected.Packfile = ioutil.NopCloser(bytes.NewReader(packfileContent))
+ expected.Packfile = io.NopCloser(bytes.NewReader(packfileContent))
payloads := []string{
"1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00",
@@ -298,10 +297,10 @@ func (s *UpdReqDecodeSuite) testDecodeOkExpected(c *C, expected *ReferenceUpdate
}
func (s *UpdReqDecodeSuite) compareReaders(c *C, a io.ReadCloser, b io.ReadCloser) {
- pba, err := ioutil.ReadAll(a)
+ pba, err := io.ReadAll(a)
c.Assert(err, IsNil)
c.Assert(a.Close(), IsNil)
- pbb, err := ioutil.ReadAll(b)
+ pbb, err := io.ReadAll(b)
c.Assert(err, IsNil)
c.Assert(b.Close(), IsNil)
c.Assert(pba, DeepEquals, pbb)
diff --git a/plumbing/protocol/packp/updreq_encode_test.go b/plumbing/protocol/packp/updreq_encode_test.go
index 4370b79..97868bd 100644
--- a/plumbing/protocol/packp/updreq_encode_test.go
+++ b/plumbing/protocol/packp/updreq_encode_test.go
@@ -2,13 +2,12 @@ package packp
import (
"bytes"
+ "io"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/format/pktline"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
- "io/ioutil"
-
. "gopkg.in/check.v1"
)
@@ -128,7 +127,7 @@ func (s *UpdReqEncodeSuite) TestWithPackfile(c *C) {
packfileContent := []byte("PACKabc")
packfileReader := bytes.NewReader(packfileContent)
- packfileReadCloser := ioutil.NopCloser(packfileReader)
+ packfileReadCloser := io.NopCloser(packfileReader)
r := NewReferenceUpdateRequest()
r.Commands = []*Command{
diff --git a/plumbing/protocol/packp/uppackresp_test.go b/plumbing/protocol/packp/uppackresp_test.go
index 3f87804..8fbf924 100644
--- a/plumbing/protocol/packp/uppackresp_test.go
+++ b/plumbing/protocol/packp/uppackresp_test.go
@@ -2,7 +2,7 @@ package packp
import (
"bytes"
- "io/ioutil"
+ "io"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
@@ -21,10 +21,10 @@ func (s *UploadPackResponseSuite) TestDecodeNAK(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, IsNil)
- pack, err := ioutil.ReadAll(res)
+ pack, err := io.ReadAll(res)
c.Assert(err, IsNil)
c.Assert(pack, DeepEquals, []byte("PACK"))
}
@@ -38,10 +38,10 @@ func (s *UploadPackResponseSuite) TestDecodeDepth(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, IsNil)
- pack, err := ioutil.ReadAll(res)
+ pack, err := io.ReadAll(res)
c.Assert(err, IsNil)
c.Assert(pack, DeepEquals, []byte("PACK"))
}
@@ -55,7 +55,7 @@ func (s *UploadPackResponseSuite) TestDecodeMalformed(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBufferString(raw)))
+ err := res.Decode(io.NopCloser(bytes.NewBufferString(raw)))
c.Assert(err, NotNil)
}
@@ -70,7 +70,7 @@ func (s *UploadPackResponseSuite) TestDecodeMultiACK(c *C) {
res := NewUploadPackResponse(req)
defer res.Close()
- err := res.Decode(ioutil.NopCloser(bytes.NewBuffer(nil)))
+ err := res.Decode(io.NopCloser(bytes.NewBuffer(nil)))
c.Assert(err, IsNil)
}
@@ -87,7 +87,7 @@ func (s *UploadPackResponseSuite) TestReadNoDecode(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeNAK(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
req := NewUploadPackRequest()
res := NewUploadPackResponseWithPackfile(req, pf)
defer func() { c.Assert(res.Close(), IsNil) }()
@@ -100,7 +100,7 @@ func (s *UploadPackResponseSuite) TestEncodeNAK(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeDepth(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("PACK")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("PACK")))
req := NewUploadPackRequest()
req.Depth = DepthCommits(1)
@@ -115,7 +115,7 @@ func (s *UploadPackResponseSuite) TestEncodeDepth(c *C) {
}
func (s *UploadPackResponseSuite) TestEncodeMultiACK(c *C) {
- pf := ioutil.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
+ pf := io.NopCloser(bytes.NewBuffer([]byte("[PACK]")))
req := NewUploadPackRequest()
res := NewUploadPackResponseWithPackfile(req, pf)