MCPcopy Create free account
hub / github.com/go-git/go-git / Open

Function Open

repository.go:204–215  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

202// repository is a normal one (not bare) and worktree is nil the err
203// ErrWorktreeNotProvided is returned
204func Open(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
205 _, err := s.Reference(plumbing.HEAD)
206 if err == plumbing.ErrReferenceNotFound {
207 return nil, ErrRepositoryNotExists
208 }
209
210 if err != nil {
211 return nil, err
212 }
213
214 return newRepository(s, worktree), nil
215}
216
217// Clone a repository into the given Storer and worktree Filesystem with the
218// given options, if worktree is nil a bare repository is created. If the given

Callers 15

testPruneMethod · 0.85
TestOpenMethod · 0.85
TestOpenBareMethod · 0.85
TestOpenNotExistsMethod · 0.85
TestBranchesMethod · 0.85
TestResolveRevisionMethod · 0.85
testRepackObjectsMethod · 0.85
BenchmarkObjectsFunction · 0.85
PlainOpenWithOptionsFunction · 0.85

Calls 2

newRepositoryFunction · 0.85
ReferenceMethod · 0.65

Tested by 15

testPruneMethod · 0.68
TestOpenMethod · 0.68
TestOpenBareMethod · 0.68
TestOpenNotExistsMethod · 0.68
TestBranchesMethod · 0.68
TestResolveRevisionMethod · 0.68
testRepackObjectsMethod · 0.68
BenchmarkObjectsFunction · 0.68
NewRepositoryMethod · 0.68