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