MCPcopy Create free account
hub / github.com/go-git/go-git / TestObjectStat

Method TestObjectStat

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

Source from the content-addressed store, hash-verified

681}
682
683func (s *SuiteDotGit) TestObjectStat(c *C) {
684 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
685 dir := New(fs)
686
687 hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
688 _, err := dir.ObjectStat(hash)
689 c.Assert(err, IsNil)
690 incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
691 incomingDirPath := fs.Join("objects", "tmp_objdir-incoming-123456")
692 incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
693 fs.MkdirAll(incomingDirPath, os.FileMode(0755))
694 fs.Create(incomingFilePath)
695
696 _, err = dir.ObjectStat(plumbing.NewHash(incomingHash))
697 c.Assert(err, IsNil)
698}
699
700func (s *SuiteDotGit) TestObjectDelete(c *C) {
701 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected