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

Function setConfigWorktree

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

Source from the content-addressed store, hash-verified

177}
178
179func setConfigWorktree(r *Repository, worktree, storage billy.Filesystem) error {
180 path, err := filepath.Rel(storage.Root(), worktree.Root())
181 if err != nil {
182 path = worktree.Root()
183 }
184
185 if path == ".." {
186 // not needed, since the folder is the default place
187 return nil
188 }
189
190 cfg, err := r.Config()
191 if err != nil {
192 return err
193 }
194
195 cfg.Core.Worktree = path
196 return r.Storer.SetConfig(cfg)
197}
198
199// Open opens a git repository using the given Storer and worktree filesystem,
200// if the given storer is complete empty ErrRepositoryNotExists is returned.

Callers 1

Calls 3

RootMethod · 0.80
ConfigMethod · 0.65
SetConfigMethod · 0.65

Tested by

no test coverage detected