aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2021-12-10 06:52:00 +0100
committerGitHub <noreply@github.com>2021-12-10 06:52:00 +0100
commit32c4f532abd57797322e97d95dfa02821980e309 (patch)
tree63afb89d42b388316d045820b44972f54e0b8f01 /plumbing
parent39f97ab86a776dd8acd58a79a660d0cfdb7068c0 (diff)
parentfe158cd6e176682e087efea9625ec5409f2956bf (diff)
downloadgo-git-32c4f532abd57797322e97d95dfa02821980e309.tar.gz
Merge pull request #406 from john-cai/jc-push-atomic
Remote: Push, add atomic to push options
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/protocol/packp/updreq_encode_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/plumbing/protocol/packp/updreq_encode_test.go b/plumbing/protocol/packp/updreq_encode_test.go
index 6ba0043..4370b79 100644
--- a/plumbing/protocol/packp/updreq_encode_test.go
+++ b/plumbing/protocol/packp/updreq_encode_test.go
@@ -170,3 +170,22 @@ func (s *UpdReqEncodeSuite) TestPushOptions(c *C) {
s.testEncode(c, r, expected)
}
+
+func (s *UpdReqEncodeSuite) TestPushAtomic(c *C) {
+ hash1 := plumbing.NewHash("1ecf0ef2c2dffb796033e5a02219af86ec6584e5")
+ hash2 := plumbing.NewHash("2ecf0ef2c2dffb796033e5a02219af86ec6584e5")
+ name := plumbing.ReferenceName("myref")
+
+ r := NewReferenceUpdateRequest()
+ r.Capabilities.Set(capability.Atomic)
+ r.Commands = []*Command{
+ {Name: name, Old: hash1, New: hash2},
+ }
+
+ expected := pktlines(c,
+ "1ecf0ef2c2dffb796033e5a02219af86ec6584e5 2ecf0ef2c2dffb796033e5a02219af86ec6584e5 myref\x00atomic",
+ pktline.FlushString,
+ )
+
+ s.testEncode(c, r, expected)
+}