diff options
Diffstat (limited to 'plumbing/transport')
-rw-r--r-- | plumbing/transport/fetch_pack.go | 19 | ||||
-rw-r--r-- | plumbing/transport/fetch_pack_test.go | 4 | ||||
-rw-r--r-- | plumbing/transport/http/fetch_pack.go | 6 | ||||
-rw-r--r-- | plumbing/transport/ssh/fetch_pack.go | 13 |
4 files changed, 20 insertions, 22 deletions
diff --git a/plumbing/transport/fetch_pack.go b/plumbing/transport/fetch_pack.go index 5346e9d..14d3e19 100644 --- a/plumbing/transport/fetch_pack.go +++ b/plumbing/transport/fetch_pack.go @@ -8,14 +8,13 @@ import ( "strings" "gopkg.in/src-d/go-git.v4/plumbing" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/advrefs" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/pktline" + "gopkg.in/src-d/go-git.v4/plumbing/format/pktline" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" "gopkg.in/src-d/go-git.v4/plumbing/storer" "gopkg.in/src-d/go-git.v4/storage/memory" ) -//TODO: Replace this by advrefs.AdvRefs. +//TODO: Replace this by packpAdvRefs. type UploadPackInfo struct { Capabilities *packp.Capabilities Refs memory.ReferenceStorage @@ -29,10 +28,10 @@ func NewUploadPackInfo() *UploadPackInfo { } func (i *UploadPackInfo) Decode(r io.Reader) error { - d := advrefs.NewDecoder(r) - ar := advrefs.New() + d := packp.NewAdvRefsDecoder(r) + ar := packp.NewAdvRefs() if err := d.Decode(ar); err != nil { - if err == advrefs.ErrEmpty { + if err == packp.ErrEmpty { return err } return plumbing.NewUnexpectedError(err) @@ -47,7 +46,7 @@ func (i *UploadPackInfo) Decode(r io.Reader) error { return nil } -func (i *UploadPackInfo) addRefs(ar *advrefs.AdvRefs) error { +func (i *UploadPackInfo) addRefs(ar *packp.AdvRefs) error { for name, hash := range ar.References { ref := plumbing.NewReferenceFromStrings(name, hash.String()) i.Refs.SetReference(ref) @@ -56,7 +55,7 @@ func (i *UploadPackInfo) addRefs(ar *advrefs.AdvRefs) error { return i.addSymbolicRefs(ar) } -func (i *UploadPackInfo) addSymbolicRefs(ar *advrefs.AdvRefs) error { +func (i *UploadPackInfo) addSymbolicRefs(ar *packp.AdvRefs) error { if !hasSymrefs(ar) { return nil } @@ -76,7 +75,7 @@ func (i *UploadPackInfo) addSymbolicRefs(ar *advrefs.AdvRefs) error { return nil } -func hasSymrefs(ar *advrefs.AdvRefs) bool { +func hasSymrefs(ar *packp.AdvRefs) bool { return ar.Capabilities.Supports("symref") } diff --git a/plumbing/transport/fetch_pack_test.go b/plumbing/transport/fetch_pack_test.go index 16112a9..fc77fe2 100644 --- a/plumbing/transport/fetch_pack_test.go +++ b/plumbing/transport/fetch_pack_test.go @@ -5,7 +5,7 @@ import ( "encoding/base64" "gopkg.in/src-d/go-git.v4/plumbing" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/advrefs" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" . "gopkg.in/check.v1" ) @@ -59,7 +59,7 @@ func (s *UploadPackSuite) TestUploadPackInfoEmpty(c *C) { i := NewUploadPackInfo() err := i.Decode(b) - c.Assert(err, Equals, advrefs.ErrEmpty) + c.Assert(err, Equals, packp.ErrEmpty) } func (s *UploadPackSuite) TestUploadPackEncode(c *C) { diff --git a/plumbing/transport/http/fetch_pack.go b/plumbing/transport/http/fetch_pack.go index 0becb7b..29e385b 100644 --- a/plumbing/transport/http/fetch_pack.go +++ b/plumbing/transport/http/fetch_pack.go @@ -8,8 +8,8 @@ import ( "strings" "gopkg.in/src-d/go-git.v4/plumbing" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/advrefs" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/pktline" + "gopkg.in/src-d/go-git.v4/plumbing/format/pktline" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/utils/ioutil" ) @@ -64,7 +64,7 @@ func (s *fetchPackSession) AdvertisedReferences() (*transport.UploadPackInfo, i := transport.NewUploadPackInfo() if err := i.Decode(res.Body); err != nil { - if err == advrefs.ErrEmpty { + if err == packp.ErrEmpty { err = transport.ErrEmptyRemoteRepository } diff --git a/plumbing/transport/ssh/fetch_pack.go b/plumbing/transport/ssh/fetch_pack.go index b43160a..decd9c4 100644 --- a/plumbing/transport/ssh/fetch_pack.go +++ b/plumbing/transport/ssh/fetch_pack.go @@ -7,9 +7,8 @@ import ( "fmt" "io" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/advrefs" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/pktline" - "gopkg.in/src-d/go-git.v4/plumbing/format/packp/ulreq" + "gopkg.in/src-d/go-git.v4/plumbing/format/pktline" + "gopkg.in/src-d/go-git.v4/plumbing/protocol/packp" "gopkg.in/src-d/go-git.v4/plumbing/transport" "gopkg.in/src-d/go-git.v4/utils/ioutil" @@ -49,7 +48,7 @@ func (s *fetchPackSession) AdvertisedReferences() (*transport.UploadPackInfo, er i := transport.NewUploadPackInfo() if err := i.Decode(s.stdout); err != nil { - if err != advrefs.ErrEmpty { + if err != packp.ErrEmpty { return nil, err } @@ -188,10 +187,10 @@ func fetchPack(w io.WriteCloser, r io.Reader, } func sendUlReq(w io.Writer, req *transport.UploadPackRequest) error { - ur := ulreq.New() + ur := packp.NewUlReq() ur.Wants = req.Wants - ur.Depth = ulreq.DepthCommits(req.Depth) - e := ulreq.NewEncoder(w) + ur.Depth = packp.DepthCommits(req.Depth) + e := packp.NewUlReqEncoder(w) return e.Encode(ur) } |