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

Method UpstreamName

branch.go:247–264  ·  view source on GitHub ↗
(canonicalBranchName string)

Source from the content-addressed store, hash-verified

245}
246
247func (repo *Repository) UpstreamName(canonicalBranchName string) (string, error) {
248 cName := C.CString(canonicalBranchName)
249 defer C.free(unsafe.Pointer(cName))
250
251 nameBuf := C.git_buf{}
252
253 runtime.LockOSThread()
254 defer runtime.UnlockOSThread()
255
256 ret := C.git_branch_upstream_name(&nameBuf, repo.ptr, cName)
257 runtime.KeepAlive(repo)
258 if ret < 0 {
259 return "", MakeGitError(ret)
260 }
261 defer C.git_buf_dispose(&nameBuf)
262
263 return C.GoString(nameBuf.ptr), nil
264}

Callers

nothing calls this directly

Calls 2

MakeGitErrorFunction · 0.85
freeMethod · 0.80

Tested by

no test coverage detected