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

Function setWorktreeAndStoragePaths

repository.go:139–156  ·  view source on GitHub ↗
(r *Repository, worktree billy.Filesystem)

Source from the content-addressed store, hash-verified

137}
138
139func setWorktreeAndStoragePaths(r *Repository, worktree billy.Filesystem) error {
140 type fsBased interface {
141 Filesystem() billy.Filesystem
142 }
143
144 // .git file is only created if the storage is file based and the file
145 // system is osfs.OS
146 fs, isFSBased := r.Storer.(fsBased)
147 if !isFSBased {
148 return nil
149 }
150
151 if err := createDotGitFile(worktree, fs.Filesystem()); err != nil {
152 return err
153 }
154
155 return setConfigWorktree(r, worktree, fs.Filesystem())
156}
157
158func createDotGitFile(worktree, storage billy.Filesystem) error {
159 path, err := filepath.Rel(worktree.Root(), storage.Root())

Callers 1

InitWithOptionsFunction · 0.85

Calls 3

createDotGitFileFunction · 0.85
setConfigWorktreeFunction · 0.85
FilesystemMethod · 0.65

Tested by

no test coverage detected