CreateWithOptions Creates a repository object with extended options.
(url string, option *RemoteCreateOptions)
| 687 | |
| 688 | //CreateWithOptions Creates a repository object with extended options. |
| 689 | func (c *RemoteCollection) CreateWithOptions(url string, option *RemoteCreateOptions) (*Remote, error) { |
| 690 | remote := &Remote{repo: c.repo} |
| 691 | |
| 692 | curl := C.CString(url) |
| 693 | defer C.free(unsafe.Pointer(curl)) |
| 694 | |
| 695 | runtime.LockOSThread() |
| 696 | defer runtime.UnlockOSThread() |
| 697 | |
| 698 | copts := populateRemoteCreateOptions(&C.git_remote_create_options{}, option, c.repo) |
| 699 | defer freeRemoteCreateOptions(copts) |
| 700 | |
| 701 | ret := C.git_remote_create_with_opts(&remote.ptr, curl, copts) |
| 702 | runtime.KeepAlive(c.repo) |
| 703 | if ret < 0 { |
| 704 | return nil, MakeGitError(ret) |
| 705 | } |
| 706 | c.trackRemote(remote) |
| 707 | return remote, nil |
| 708 | } |
| 709 | |
| 710 | func (c *RemoteCollection) Delete(name string) error { |
| 711 | cname := C.CString(name) |