diff options
| author | lhchavez <[email protected]> | 2021-09-03 06:40:31 -0700 |
|---|---|---|
| committer | lhchavez <[email protected]> | 2021-09-05 18:52:01 -0700 |
| commit | 018647fd481a7eb4af97d5f61afc0fddfe76fc24 (patch) | |
| tree | 06f4af28f0298ffe4bd93d2061f7eb8c52518bc2 /remote.go | |
| parent | b78bde3d74b1617d5b635723552aaec0583eb054 (diff) | |
libgit2 v1.2.0 #major
This commit introduces libgit2 v1.2.0 to git2go, which brings a large
number of [bugfixes and
features](https://github.com/libgit2/libgit2/releases/tag/v1.2.0).
This also marks the start of the v32 release.
Diffstat (limited to 'remote.go')
| -rw-r--r-- | remote.go | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -564,12 +564,20 @@ func freeProxyOptions(copts *C.git_proxy_options) { C.free(unsafe.Pointer(copts.url)) } -// RemoteIsValidName returns whether the remote name is well-formed. -func RemoteIsValidName(name string) bool { +// RemoteNameIsValid returns whether the remote name is well-formed. +func RemoteNameIsValid(name string) (bool, error) { cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) - return C.git_remote_is_valid_name(cname) == 1 + runtime.LockOSThread() + defer runtime.UnlockOSThread() + + var valid C.int + ret := C.git_remote_name_is_valid(&valid, cname) + if ret < 0 { + return false, MakeGitError(ret) + } + return valid == 1, nil } // free releases the resources of the Remote. |
