(worktree, storage billy.Filesystem)
| 156 | } |
| 157 | |
| 158 | func createDotGitFile(worktree, storage billy.Filesystem) error { |
| 159 | path, err := filepath.Rel(worktree.Root(), storage.Root()) |
| 160 | if err != nil { |
| 161 | path = storage.Root() |
| 162 | } |
| 163 | |
| 164 | if path == GitDirName { |
| 165 | // not needed, since the folder is the default place |
| 166 | return nil |
| 167 | } |
| 168 | |
| 169 | f, err := worktree.Create(GitDirName) |
| 170 | if err != nil { |
| 171 | return err |
| 172 | } |
| 173 | |
| 174 | defer f.Close() |
| 175 | _, err = fmt.Fprintf(f, "gitdir: %s\n", path) |
| 176 | return err |
| 177 | } |
| 178 | |
| 179 | func setConfigWorktree(r *Repository, worktree, storage billy.Filesystem) error { |
| 180 | path, err := filepath.Rel(storage.Root(), worktree.Root()) |
no test coverage detected