MCPcopy Index your code
hub / github.com/go-git/go-git / assertStorageStatus

Function assertStorageStatus

worktree_commit_test.go:660–678  ·  view source on GitHub ↗
(
	c *C, r *Repository,
	treesCount, blobCount, commitCount int, head plumbing.Hash,
)

Source from the content-addressed store, hash-verified

658}
659
660func assertStorageStatus(
661 c *C, r *Repository,
662 treesCount, blobCount, commitCount int, head plumbing.Hash,
663) {
664 trees, err := r.Storer.IterEncodedObjects(plumbing.TreeObject)
665 c.Assert(err, IsNil)
666 blobs, err := r.Storer.IterEncodedObjects(plumbing.BlobObject)
667 c.Assert(err, IsNil)
668 commits, err := r.Storer.IterEncodedObjects(plumbing.CommitObject)
669 c.Assert(err, IsNil)
670
671 c.Assert(lenIterEncodedObjects(trees), Equals, treesCount)
672 c.Assert(lenIterEncodedObjects(blobs), Equals, blobCount)
673 c.Assert(lenIterEncodedObjects(commits), Equals, commitCount)
674
675 ref, err := r.Head()
676 c.Assert(err, IsNil)
677 c.Assert(ref.Hash(), Equals, head)
678}
679
680func lenIterEncodedObjects(iter storer.EncodedObjectIter) int {
681 count := 0

Calls 4

lenIterEncodedObjectsFunction · 0.85
HeadMethod · 0.80
IterEncodedObjectsMethod · 0.65
HashMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…