Open opens a git repository using the given Storer and worktree filesystem, if the given storer is complete empty ErrRepositoryNotExists is returned. The worktree can be nil when the repository being opened is bare, if the repository is a normal one (not bare) and worktree is nil the err ErrWorktree
(s storage.Storer, worktree billy.Filesystem)
| 203 | // repository is a normal one (not bare) and worktree is nil the err |
| 204 | // ErrWorktreeNotProvided is returned |
| 205 | func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) { |
| 206 | _, err := s.Reference(plumbing.HEAD) |
| 207 | if err == plumbing.ErrReferenceNotFound { |
| 208 | return nil, ErrRepositoryNotExists |
| 209 | } |
| 210 | |
| 211 | cfg, err := s.Config() |
| 212 | if err != nil { |
| 213 | return nil, err |
| 214 | } |
| 215 | |
| 216 | err = verifyExtensions(s, cfg) |
| 217 | if err != nil { |
| 218 | return nil, err |
| 219 | } |
| 220 | |
| 221 | return newRepository(s, worktree), nil |
| 222 | } |
| 223 | |
| 224 | // Clone a repository into the given Storer and worktree Filesystem with the |
| 225 | // given options, if worktree is nil a bare repository is created. If the given |
searching dependent graphs…