From 1c2fb310fbd3e08fddb43344c1473c27b154ef73 Mon Sep 17 00:00:00 2001 From: Miguel Molina Date: Tue, 5 Sep 2017 17:32:16 +0200 Subject: remote: iterate over reference only once Signed-off-by: Miguel Molina --- remote_test.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'remote_test.go') diff --git a/remote_test.go b/remote_test.go index 10f6708..def5c8d 100644 --- a/remote_test.go +++ b/remote_test.go @@ -625,20 +625,22 @@ func (s *RemoteSuite) TestPushWrongRemoteName(c *C) { } func (s *RemoteSuite) TestGetHaves(c *C) { - st := memory.NewStorage() - st.SetReference(plumbing.NewReferenceFromStrings( - "foo", "f7b877701fbf855b44c0a9e86f3fdce2c298b07f", - )) - - st.SetReference(plumbing.NewReferenceFromStrings( - "bar", "fe6cb94756faa81e5ed9240f9191b833db5f40ae", - )) - - st.SetReference(plumbing.NewReferenceFromStrings( - "qux", "f7b877701fbf855b44c0a9e86f3fdce2c298b07f", - )) + var localRefs = []*plumbing.Reference{ + plumbing.NewReferenceFromStrings( + "foo", + "f7b877701fbf855b44c0a9e86f3fdce2c298b07f", + ), + plumbing.NewReferenceFromStrings( + "bar", + "fe6cb94756faa81e5ed9240f9191b833db5f40ae", + ), + plumbing.NewReferenceFromStrings( + "qux", + "f7b877701fbf855b44c0a9e86f3fdce2c298b07f", + ), + } - l, err := getHaves(st) + l, err := getHaves(localRefs) c.Assert(err, IsNil) c.Assert(l, HasLen, 2) } -- cgit