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

Function setConfigWorktree

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…