MCPcopy
hub / github.com/go-git/go-git / NewRepositoryWithEmptyWorktree

Method NewRepositoryWithEmptyWorktree

common_test.go:77–100  ·  view source on GitHub ↗

NewRepositoryWithEmptyWorktree returns a new repository using the .git folder from the fixture but without a empty memfs worktree, the index and the modules are deleted from the .git folder.

(f *fixtures.Fixture)

Source from the content-addressed store, hash-verified

75// from the fixture but without a empty memfs worktree, the index and the
76// modules are deleted from the .git folder.
77func (s *BaseSuite) NewRepositoryWithEmptyWorktree(f *fixtures.Fixture) *Repository {
78 dotgit := f.DotGit()
79 err := dotgit.Remove("index")
80 if err != nil {
81 panic(err)
82 }
83
84 err = util.RemoveAll(dotgit, "modules")
85 if err != nil {
86 panic(err)
87 }
88
89 worktree := memfs.New()
90
91 st := filesystem.NewStorage(dotgit, cache.NewObjectLRUDefault())
92
93 r, err := Open(st, worktree)
94 if err != nil {
95 panic(err)
96 }
97
98 return r
99
100}
101
102func (s *BaseSuite) NewRepositoryFromPackfile(f *fixtures.Fixture) *Repository {
103 h := f.PackfileHash

Callers 6

SetUpTestMethod · 0.80
TestCheckoutSubmoduleMethod · 0.80
TestCheckoutTagMethod · 0.80
TestCheckoutTagHashMethod · 0.80
testCheckoutBisectMethod · 0.80

Calls 4

NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
OpenFunction · 0.85
RemoveMethod · 0.45

Tested by

no test coverage detected