MCPcopy
hub / github.com/go-git/go-git / Init

Function Init

repository.go:88–93  ·  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

86// The worktree Filesystem is optional, if nil a bare repository is created. If
87// the given storer is not empty ErrRepositoryAlreadyExists is returned
88func Init(s storage.Storer, worktree billy.Filesystem) (*Repository, error) {
89 options := InitOptions{
90 DefaultBranch: plumbing.Master,
91 }
92 return InitWithOptions(s, worktree, options)
93}
94
95func InitWithOptions(s storage.Storer, worktree billy.Filesystem, options InitOptions) (*Repository, error) {
96 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…