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

Method Add

submodule.go:161–176  ·  view source on GitHub ↗
(url, path string, use_git_link bool)

Source from the content-addressed store, hash-verified

159}
160
161func (c *SubmoduleCollection) Add(url, path string, use_git_link bool) (*Submodule, error) {
162 curl := C.CString(url)
163 defer C.free(unsafe.Pointer(curl))
164 cpath := C.CString(path)
165 defer C.free(unsafe.Pointer(cpath))
166
167 runtime.LockOSThread()
168 defer runtime.UnlockOSThread()
169
170 var ptr *C.git_submodule
171 ret := C.git_submodule_add_setup(&ptr, c.repo.ptr, curl, cpath, cbool(use_git_link))
172 if ret < 0 {
173 return nil, MakeGitError(ret)
174 }
175 return newSubmoduleFromC(ptr, c.repo), nil
176}
177
178func (sub *Submodule) FinalizeAdd() error {
179 runtime.LockOSThread()

Callers

nothing calls this directly

Calls 4

cboolFunction · 0.85
MakeGitErrorFunction · 0.85
newSubmoduleFromCFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected