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

Method TestObject

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

Source from the content-addressed store, hash-verified

665}
666
667func (s *SuiteDotGit) TestObject(c *C) {
668 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
669 dir := New(fs)
670
671 hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
672 file, err := dir.Object(hash)
673 c.Assert(err, IsNil)
674 c.Assert(strings.HasSuffix(
675 file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
676 Equals, true,
677 )
678 incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
679 incomingDirPath := fs.Join("objects", "tmp_objdir-incoming-123456")
680 incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
681 fs.MkdirAll(incomingDirPath, os.FileMode(0755))
682 fs.Create(incomingFilePath)
683
684 _, err = dir.Object(plumbing.NewHash(incomingHash))
685 c.Assert(err, IsNil)
686}
687
688func (s *SuiteDotGit) TestPreGit235Object(c *C) {
689 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected