(r *Repository, worktree billy.Filesystem)
| 137 | } |
| 138 | |
| 139 | func setWorktreeAndStoragePaths(r *Repository, worktree billy.Filesystem) error { |
| 140 | type fsBased interface { |
| 141 | Filesystem() billy.Filesystem |
| 142 | } |
| 143 | |
| 144 | // .git file is only created if the storage is file based and the file |
| 145 | // system is osfs.OS |
| 146 | fs, isFSBased := r.Storer.(fsBased) |
| 147 | if !isFSBased { |
| 148 | return nil |
| 149 | } |
| 150 | |
| 151 | if err := createDotGitFile(worktree, fs.Filesystem()); err != nil { |
| 152 | return err |
| 153 | } |
| 154 | |
| 155 | return setConfigWorktree(r, worktree, fs.Filesystem()) |
| 156 | } |
| 157 | |
| 158 | func createDotGitFile(worktree, storage billy.Filesystem) error { |
| 159 | path, err := filepath.Rel(worktree.Root(), storage.Root()) |
no test coverage detected