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

Method TestPreGit235Object

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

Source from the content-addressed store, hash-verified

686}
687
688func (s *SuiteDotGit) TestPreGit235Object(c *C) {
689 fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
690 dir := New(fs)
691
692 hash := plumbing.NewHash("03db8e1fbe133a480f2867aac478fd866686d69e")
693 file, err := dir.Object(hash)
694 c.Assert(err, IsNil)
695 c.Assert(strings.HasSuffix(
696 file.Name(), fs.Join("objects", "03", "db8e1fbe133a480f2867aac478fd866686d69e")),
697 Equals, true,
698 )
699 incomingHash := "9d25e0f9bde9f82882b49fe29117b9411cb157b7" // made up hash
700 incomingDirPath := fs.Join("objects", "incoming-123456")
701 incomingFilePath := fs.Join(incomingDirPath, incomingHash[0:2], incomingHash[2:40])
702 fs.MkdirAll(incomingDirPath, os.FileMode(0755))
703 fs.Create(incomingFilePath)
704
705 _, err = dir.Object(plumbing.NewHash(incomingHash))
706 c.Assert(err, IsNil)
707}
708
709func (s *SuiteDotGit) TestObjectStat(c *C) {
710 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