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

Function createDotGitFile

repository.go:159–178  ·  view source on GitHub ↗
(worktree, storage billy.Filesystem)

Source from the content-addressed store, hash-verified

157}
158
159func createDotGitFile(worktree, storage billy.Filesystem) error {
160 path, err := filepath.Rel(worktree.Root(), storage.Root())
161 if err != nil {
162 path = storage.Root()
163 }
164
165 if path == GitDirName {
166 // not needed, since the folder is the default place
167 return nil
168 }
169
170 f, err := worktree.Create(GitDirName)
171 if err != nil {
172 return err
173 }
174
175 defer f.Close()
176 _, err = fmt.Fprintf(f, "gitdir: %s\n", path)
177 return err
178}
179
180func setConfigWorktree(r *Repository, worktree, storage billy.Filesystem) error {
181 path, err := filepath.Rel(storage.Root(), worktree.Root())

Callers 1

Calls 3

RootMethod · 0.80
CloseMethod · 0.65
CreateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…