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

Method TestObjectDelete

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

NewHashFunction · 0.92
ObjectDeleteMethod · 0.80
JoinMethod · 0.80
MkdirAllMethod · 0.80
CreateMethod · 0.80
NewFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected