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

Method TestObjectStat

storage/filesystem/dotgit/dotgit_test.go:709–724  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

707}
708
709func (s *SuiteDotGit) TestObjectStat(c *C) {
710 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
711 dir := New(fs)
712
713 hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
714 _, err := dir.ObjectStat(hash)
715 c.Assert(err, IsNil)
716 incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
717 incomingDirPath := fs.Join("objects", "tmp_objdir-incoming-123456")
718 incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
719 fs.MkdirAll(incomingDirPath, os.FileMode(0755))
720 fs.Create(incomingFilePath)
721
722 _, err = dir.ObjectStat(plumbing.NewHash(incomingHash))
723 c.Assert(err, IsNil)
724}
725
726func (s *SuiteDotGit) TestObjectDelete(c *C) {
727 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()

Callers

nothing calls this directly

Calls 6

NewHashFunction · 0.92
ObjectStatMethod · 0.80
JoinMethod · 0.80
NewFunction · 0.70
MkdirAllMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected