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

Function Init

repository.go:87–92  ·  view source on GitHub ↗

Init creates an empty git repository, based on the given Storer and worktree. The worktree Filesystem is optional, if nil a bare repository is created. If the given storer is not empty ErrRepositoryAlreadyExists is returned

(s storage.Storer, worktree billy.Filesystem)

Source from the content-addressed store, hash-verified

85// The worktree Filesystem is optional, if nil a bare repository is created. If
86// the given storer is not empty ErrRepositoryAlreadyExists is returned
87func Init(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
88 options := InitOptions{
89 DefaultBranch: plumbing.Master,
90 }
91 return InitWithOptions(s, worktree, options)
92}
93
94func InitWithOptions(s storage.Storer, worktree billy.Filesystem, options InitOptions) (*Repository, error) {
95 if err := initStorer(s); err != nil {

Callers 15

TestInitMethod · 0.85
TestInitBareMethod · 0.85
TestInitAlreadyExistsMethod · 0.85
TestOpenMethod · 0.85
TestOpenBareMethod · 0.85

Calls 1

InitWithOptionsFunction · 0.85

Tested by 15

TestInitMethod · 0.68
TestInitBareMethod · 0.68
TestInitAlreadyExistsMethod · 0.68
TestOpenMethod · 0.68
TestOpenBareMethod · 0.68