aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/advrefs_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-11-28 09:57:38 +0100
committerGitHub <noreply@github.com>2016-11-28 09:57:38 +0100
commit68893edf9ddc3de181431f1552e3b773cb66f080 (patch)
treef45e5fa18e10168a278b7d0ed7dea984ff9969f7 /plumbing/protocol/packp/advrefs_test.go
parentf9adb3565b36ba1573102f954d0ee916009efac2 (diff)
downloadgo-git-68893edf9ddc3de181431f1552e3b773cb66f080.tar.gz
remove old types from transport and use packp (#142)
* protocol: move UploadPackRequest to protocol. * UploadPackRequest is now defined as an embedding of UploadRequest and UploadHaves. * Move http encoding specific code from UploadPackRequest to transport/http. * rename UlReq to UploadRequest * packp: move AdvRefs Encoder/Decoder to Encode/Decode methods. * packp: move UploadRequest Encoder/Decoder to Encode/Decode methods. * packp: Remove transport.UploadPackInfo in favor of packp. AdvRefs.
Diffstat (limited to 'plumbing/protocol/packp/advrefs_test.go')
-rw-r--r--plumbing/protocol/packp/advrefs_test.go16
1 files changed, 4 insertions, 12 deletions
diff --git a/plumbing/protocol/packp/advrefs_test.go b/plumbing/protocol/packp/advrefs_test.go
index 1a696d4..6d9f488 100644
--- a/plumbing/protocol/packp/advrefs_test.go
+++ b/plumbing/protocol/packp/advrefs_test.go
@@ -44,14 +44,10 @@ func (s *SuiteDecodeEncode) test(c *C, in []string, exp []string) {
var obtained []byte
{
ar := packp.NewAdvRefs()
- d := packp.NewAdvRefsDecoder(input)
- err = d.Decode(ar)
- c.Assert(err, IsNil)
+ c.Assert(ar.Decode(input), IsNil)
var buf bytes.Buffer
- e := packp.NewAdvRefsEncoder(&buf)
- err := e.Encode(ar)
- c.Assert(err, IsNil)
+ c.Assert(ar.Encode(&buf), IsNil)
obtained = buf.Bytes()
}
@@ -258,12 +254,9 @@ func ExampleDecoder_Decode() {
// Use the raw message as our input.
input := strings.NewReader(raw)
- // Create a Decoder reading from our input.
- d := packp.NewAdvRefsDecoder(input)
-
// Decode the input into a newly allocated AdvRefs value.
ar := packp.NewAdvRefs()
- _ = d.Decode(ar) // error check ignored for brevity
+ _ = ar.Decode(input) // error check ignored for brevity
// Do something interesting with the AdvRefs, e.g. print its contents.
fmt.Println("head =", ar.Head)
@@ -303,8 +296,7 @@ func ExampleEncoder_Encode() {
// You can encode into stdout too, but you will not be able
// see the '\x00' after "HEAD".
var buf bytes.Buffer
- e := packp.NewAdvRefsEncoder(&buf)
- _ = e.Encode(ar) // error checks ignored for brevity
+ _ = ar.Encode(&buf) // error checks ignored for brevity
// Print the contents of the buffer as a quoted string.
// Printing is as a non-quoted string will be prettier but you