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

Method Create

remote.go:669–686  ·  view source on GitHub ↗
(name string, url string)

Source from the content-addressed store, hash-verified

667}
668
669func (c *RemoteCollection) Create(name string, url string) (*Remote, error) {
670 remote := &Remote{repo: c.repo}
671
672 cname := C.CString(name)
673 defer C.free(unsafe.Pointer(cname))
674 curl := C.CString(url)
675 defer C.free(unsafe.Pointer(curl))
676
677 runtime.LockOSThread()
678 defer runtime.UnlockOSThread()
679
680 ret := C.git_remote_create(&remote.ptr, c.repo.ptr, cname, curl)
681 if ret < 0 {
682 return nil, MakeGitError(ret)
683 }
684 c.trackRemote(remote)
685 return remote, nil
686}
687
688//CreateWithOptions Creates a repository object with extended options.
689func (c *RemoteCollection) CreateWithOptions(url string, option *RemoteCreateOptions) (*Remote, error) {

Callers

nothing calls this directly

Calls 3

trackRemoteMethod · 0.95
MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected