MCPcopy Create free account
hub / github.com/libgit2/git2go / NewIndex

Function NewIndex

index.go:118–129  ·  view source on GitHub ↗

NewIndex allocates a new index. It won't be associated with any file on the filesystem or repository

()

Source from the content-addressed store, hash-verified

116// NewIndex allocates a new index. It won't be associated with any
117// file on the filesystem or repository
118func NewIndex() (*Index, error) {
119 var ptr *C.git_index
120
121 runtime.LockOSThread()
122 defer runtime.UnlockOSThread()
123
124 if err := C.git_index_new(&ptr); err < 0 {
125 return nil, MakeGitError(err)
126 }
127
128 return newIndexFromC(ptr, nil), nil
129}
130
131// OpenIndex creates a new index at the given path. If the file does
132// not exist it will be created when Write() is called.

Callers 5

commitSomethingFunction · 0.85
TestIndexReadTreeFunction · 0.85
TestIndexWriteTreeToFunction · 0.85
TestIndexRemoveDirectoryFunction · 0.85

Calls 2

MakeGitErrorFunction · 0.85
newIndexFromCFunction · 0.85

Tested by 5

commitSomethingFunction · 0.68
TestIndexReadTreeFunction · 0.68
TestIndexWriteTreeToFunction · 0.68
TestIndexRemoveDirectoryFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…