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

Method TestCommit

repository_test.go:2390–2412  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

2388}
2389
2390func (s *RepositorySuite) TestCommit(c *C) {
2391 r, _ := Init(memory.NewStorage(), nil)
2392 err := r.clone(context.Background(), &CloneOptions{
2393 URL: s.GetBasicLocalRepositoryURL(),
2394 })
2395
2396 c.Assert(err, IsNil)
2397
2398 hash := plumbing.NewHash("b8e471f58bcbca63b07bda20e428190409c2db47")
2399 commit, err := r.CommitObject(hash)
2400 c.Assert(err, IsNil)
2401
2402 c.Assert(commit.Hash.IsZero(), Equals, false)
2403 c.Assert(commit.Hash, Equals, commit.ID())
2404 c.Assert(commit.Hash, Equals, hash)
2405 c.Assert(commit.Type(), Equals, plumbing.CommitObject)
2406
2407 tree, err := commit.Tree()
2408 c.Assert(err, IsNil)
2409 c.Assert(tree.Hash.IsZero(), Equals, false)
2410
2411 c.Assert(commit.Author.Email, Equals, "daniel@lordran.local")
2412}
2413
2414func (s *RepositorySuite) TestCommits(c *C) {
2415 r, _ := Init(memory.NewStorage(), nil)

Callers

nothing calls this directly

Calls 10

NewStorageFunction · 0.92
NewHashFunction · 0.92
InitFunction · 0.85
cloneMethod · 0.80
CommitObjectMethod · 0.80
IsZeroMethod · 0.65
IDMethod · 0.65
TypeMethod · 0.65
TreeMethod · 0.65

Tested by

no test coverage detected