(r *Repository, worktree, storage billy.Filesystem)
| 178 | } |
| 179 | |
| 180 | func 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. |
no test coverage detected
searching dependent graphs…