aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport
diff options
context:
space:
mode:
authorBrandon Westcott <brandon@quorumcontrol.com>2020-03-19 10:20:13 -0400
committerBrandon Westcott <brandon@quorumcontrol.com>2020-03-19 10:20:13 -0400
commitcec6ee36305b9d64abf78bfac637eb164be1217a (patch)
tree5165824443497a01df13657d0128766fd852b865 /plumbing/transport
parent15f517feab93a09f633ea1b6220515adc85fe420 (diff)
downloadgo-git-cec6ee36305b9d64abf78bfac637eb164be1217a.tar.gz
plumbing: transport server test for nil Packfile
Diffstat (limited to 'plumbing/transport')
-rw-r--r--plumbing/transport/server/receive_pack_test.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/plumbing/transport/server/receive_pack_test.go b/plumbing/transport/server/receive_pack_test.go
index de072f3..2c5b0ae 100644
--- a/plumbing/transport/server/receive_pack_test.go
+++ b/plumbing/transport/server/receive_pack_test.go
@@ -1,8 +1,13 @@
package server_test
import (
+ "context"
+
+ "github.com/go-git/go-git/v5/plumbing"
+ "github.com/go-git/go-git/v5/plumbing/protocol/packp"
"github.com/go-git/go-git/v5/plumbing/transport"
+ fixtures "github.com/go-git/go-git-fixtures/v4"
. "gopkg.in/check.v1"
)
@@ -31,3 +36,28 @@ func (s *ReceivePackSuite) TestAdvertisedReferencesNotExists(c *C) {
c.Assert(err, Equals, transport.ErrRepositoryNotFound)
c.Assert(r, IsNil)
}
+
+func (s *ReceivePackSuite) TestReceivePackWithNilPackfile(c *C) {
+ endpoint := s.Endpoint
+ auth := s.EmptyAuth
+
+ fixture := fixtures.Basic().ByTag("packfile").One()
+ req := packp.NewReferenceUpdateRequest()
+ req.Commands = []*packp.Command{
+ {Name: "refs/heads/newbranch", Old: plumbing.NewHash(fixture.Head), New: plumbing.ZeroHash},
+ }
+ // default is already nil, but be explicit since this is what the test is for
+ req.Packfile = nil
+
+ comment := Commentf(
+ "failed with ep=%s fixture=%s",
+ endpoint.String(), fixture.URL,
+ )
+
+ r, err := s.Client.NewReceivePackSession(endpoint, auth)
+ c.Assert(err, IsNil, comment)
+ defer func() { c.Assert(r.Close(), IsNil, comment) }()
+
+ report, err := r.ReceivePack(context.Background(), req)
+ c.Assert(report, IsNil, comment)
+}