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

Method CreateWithFetchspec

remote.go:725–744  ·  view source on GitHub ↗
(name string, url string, fetch string)

Source from the content-addressed store, hash-verified

723}
724
725func (c *RemoteCollection) CreateWithFetchspec(name string, url string, fetch string) (*Remote, error) {
726 remote := &Remote{repo: c.repo}
727
728 cname := C.CString(name)
729 defer C.free(unsafe.Pointer(cname))
730 curl := C.CString(url)
731 defer C.free(unsafe.Pointer(curl))
732 cfetch := C.CString(fetch)
733 defer C.free(unsafe.Pointer(cfetch))
734
735 runtime.LockOSThread()
736 defer runtime.UnlockOSThread()
737
738 ret := C.git_remote_create_with_fetchspec(&remote.ptr, c.repo.ptr, cname, curl, cfetch)
739 if ret < 0 {
740 return nil, MakeGitError(ret)
741 }
742 c.trackRemote(remote)
743 return remote, nil
744}
745
746func (c *RemoteCollection) CreateAnonymous(url string) (*Remote, error) {
747 remote := &Remote{repo: c.repo}

Callers

nothing calls this directly

Calls 3

trackRemoteMethod · 0.95
MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected