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

Method Add

index.go:173–189  ·  view source on GitHub ↗

Add adds or replaces the given entry to the index, making a copy of the data

(entry *IndexEntry)

Source from the content-addressed store, hash-verified

171// Add adds or replaces the given entry to the index, making a copy of
172// the data
173func (v *Index) Add(entry *IndexEntry) error {
174 var centry C.git_index_entry
175
176 populateCIndexEntry(entry, &centry)
177 defer freeCIndexEntry(&centry)
178
179 runtime.LockOSThread()
180 defer runtime.UnlockOSThread()
181
182 err := C.git_index_add(v.ptr, &centry)
183 runtime.KeepAlive(v)
184 if err < 0 {
185 return MakeGitError(err)
186 }
187
188 return nil
189}
190
191func (v *Index) AddByPath(path string) error {
192 cstr := C.CString(path)

Callers 9

commitSomethingFunction · 0.95
TestIndexWriteTreeToFunction · 0.95
TestIndexRemoveDirectoryFunction · 0.95
ActionMethod · 0.45
ReadMethod · 0.45
newChannelPipeFunction · 0.45
TestSubmoduleForeachFunction · 0.45

Calls 3

populateCIndexEntryFunction · 0.85
freeCIndexEntryFunction · 0.85
MakeGitErrorFunction · 0.85

Tested by 7

commitSomethingFunction · 0.76
TestIndexWriteTreeToFunction · 0.76
TestIndexRemoveDirectoryFunction · 0.76
newChannelPipeFunction · 0.36
TestSubmoduleForeachFunction · 0.36