diff options
author | Paul T <paul.t@gembaadvantage.com> | 2021-11-02 07:51:10 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-02 07:51:10 +0000 |
commit | 411809ddb56551c2420c722acf49ce4e774333ad (patch) | |
tree | 353255c0c4719f39a0e1ff1b9262b98f4aedc91b /plumbing/protocol/packp/updreq_encode_test.go | |
parent | 51514482c696e7d3aadd551cd1308cedc7055ce0 (diff) | |
parent | 3211a7a12a0ec2922d257fb14f09c6ecfb0b7c77 (diff) | |
download | go-git-411809ddb56551c2420c722acf49ce4e774333ad.tar.gz |
Merge branch 'go-git:master' into codecommit-ref-delta
Diffstat (limited to 'plumbing/protocol/packp/updreq_encode_test.go')
-rw-r--r-- | plumbing/protocol/packp/updreq_encode_test.go | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/plumbing/protocol/packp/updreq_encode_test.go b/plumbing/protocol/packp/updreq_encode_test.go index 5ad2b1b..6ba0043 100644 --- a/plumbing/protocol/packp/updreq_encode_test.go +++ b/plumbing/protocol/packp/updreq_encode_test.go @@ -5,9 +5,11 @@ import ( "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" - . "gopkg.in/check.v1" "io/ioutil" + + . "gopkg.in/check.v1" ) type UpdReqEncodeSuite struct{} @@ -142,3 +144,29 @@ func (s *UpdReqEncodeSuite) TestWithPackfile(c *C) { s.testEncode(c, r, expected) } + +func (s *UpdReqEncodeSuite) TestPushOptions(c *C) { + hash1 := plumbing.NewHash("1ecf0ef2c2dffb796033e5a02219af86ec6584e5") + hash2 := plumbing.NewHash("2ecf0ef2c2dffb796033e5a02219af86ec6584e5") + name := plumbing.ReferenceName("myref") + + r := NewReferenceUpdateRequest() + r.Capabilities.Set(capability.PushOptions) + r.Commands = []*Command{ + {Name: name, Old: hash1, New: hash2}, + } + r.Options = []*Option{ + {Key: "SomeKey", Value: "SomeValue"}, + {Key: "AnotherKey", Value: "AnotherValue"}, + } + + expected := pktlines(c, + "1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00push-options", + pktline.FlushString, + "SomeKey=SomeValue", + "AnotherKey=AnotherValue", + pktline.FlushString, + ) + + s.testEncode(c, r, expected) +} |