MCPcopy Index your code
hub / github.com/go-git/go-git / Open

Function Open

repository.go:205–222  ·  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

203// repository is a normal one (not bare) and worktree is nil the err
204// ErrWorktreeNotProvided is returned
205func 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

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 4

verifyExtensionsFunction · 0.85
newRepositoryFunction · 0.85
ReferenceMethod · 0.65
ConfigMethod · 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…