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

Function createDotGitFile

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

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

RootMethod · 0.80
CreateMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected