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

Method Initialize

storage/filesystem/dotgit/dotgit.go:133–157  ·  view source on GitHub ↗

Initialize creates all the folder scaffolding.

()

Source from the content-addressed store, hash-verified

131
132// Initialize creates all the folder scaffolding.
133func (d *DotGit) Initialize() error {
134 mustExists := []string{
135 d.fs.Join("objects", "info"),
136 d.fs.Join("objects", "pack"),
137 d.fs.Join("refs", "heads"),
138 d.fs.Join("refs", "tags"),
139 }
140
141 for _, path := range mustExists {
142 _, err := d.fs.Stat(path)
143 if err == nil {
144 continue
145 }
146
147 if !os.IsNotExist(err) {
148 return err
149 }
150
151 if err := d.fs.MkdirAll(path, os.ModeDir|os.ModePerm); err != nil {
152 return err
153 }
154 }
155
156 return nil
157}
158
159// Close closes all opened files.
160func (d *DotGit) Close() error {

Callers 9

InitMethod · 0.80
TestInitializeMethod · 0.80
testAlternatesFunction · 0.80
TestAlternatesDupesFunction · 0.80
TestIssue55Function · 0.80

Calls 3

JoinMethod · 0.80
StatMethod · 0.65
MkdirAllMethod · 0.45

Tested by 8

TestInitializeMethod · 0.64
testAlternatesFunction · 0.64
TestAlternatesDupesFunction · 0.64
TestIssue55Function · 0.64