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

Method TestObject

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

Source from the content-addressed store, hash-verified

639}
640
641func (s *SuiteDotGit) TestObject(c *C) {
642 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
643 dir := New(fs)
644
645 hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
646 file, err := dir.Object(hash)
647 c.Assert(err, IsNil)
648 c.Assert(strings.HasSuffix(
649 file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
650 Equals, true,
651 )
652 incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" //made up hash
653 incomingDirPath := fs.Join("objects", "tmp_objdir-incoming-123456")
654 incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
655 fs.MkdirAll(incomingDirPath, os.FileMode(0755))
656 fs.Create(incomingFilePath)
657
658 _, err = dir.Object(plumbing.NewHash(incomingHash))
659 c.Assert(err, IsNil)
660}
661
662func (s *SuiteDotGit) TestPreGit235Object(c *C) {
663 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()

Callers

nothing calls this directly

Calls 7

NewHashFunction · 0.92
JoinMethod · 0.80
MkdirAllMethod · 0.80
CreateMethod · 0.80
NewFunction · 0.70
NameMethod · 0.65
ObjectMethod · 0.45

Tested by

no test coverage detected