MCPcopy
hub / github.com/go-git/go-git / TestCommit

Method TestCommit

storage/transactional/storage_test.go:44–68  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

42}
43
44func (s *StorageSuite) TestCommit(c *C) {
45 base := memory.NewStorage()
46 temporal := s.temporal()
47 st := NewStorage(base, temporal)
48
49 commit := base.NewEncodedObject()
50 commit.SetType(plumbing.CommitObject)
51
52 _, err := st.SetEncodedObject(commit)
53 c.Assert(err, IsNil)
54
55 ref := plumbing.NewHashReference("refs/a", commit.Hash())
56 c.Assert(st.SetReference(ref), IsNil)
57
58 err = st.Commit()
59 c.Assert(err, IsNil)
60
61 ref, err = base.Reference(ref.Name())
62 c.Assert(err, IsNil)
63 c.Assert(ref.Hash(), Equals, commit.Hash())
64
65 obj, err := base.EncodedObject(plumbing.AnyObject, commit.Hash())
66 c.Assert(err, IsNil)
67 c.Assert(obj.Hash(), Equals, commit.Hash())
68}
69
70func (s *StorageSuite) TestTransactionalPackfileWriter(c *C) {
71 base := memory.NewStorage()

Callers

nothing calls this directly

Calls 13

SetTypeMethod · 0.95
HashMethod · 0.95
CommitMethod · 0.95
NewStorageFunction · 0.92
NewHashReferenceFunction · 0.92
NewStorageFunction · 0.70
NewEncodedObjectMethod · 0.65
SetEncodedObjectMethod · 0.65
SetReferenceMethod · 0.65
ReferenceMethod · 0.65
NameMethod · 0.65
HashMethod · 0.65

Tested by

no test coverage detected