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

Method Move

branch.go:132–147  ·  view source on GitHub ↗
(newBranchName string, force bool)

Source from the content-addressed store, hash-verified

130}
131
132func (b *Branch) Move(newBranchName string, force bool) (*Branch, error) {
133 var ptr *C.git_reference
134 cNewBranchName := C.CString(newBranchName)
135 defer C.free(unsafe.Pointer(cNewBranchName))
136 cForce := cbool(force)
137
138 runtime.LockOSThread()
139 defer runtime.UnlockOSThread()
140
141 ret := C.git_branch_move(&ptr, b.Reference.ptr, cNewBranchName, cForce)
142 runtime.KeepAlive(b.Reference)
143 if ret < 0 {
144 return nil, MakeGitError(ret)
145 }
146 return newReferenceFromC(ptr, b.repo).Branch(), nil
147}
148
149func (b *Branch) IsHead() (bool, error) {
150

Callers

nothing calls this directly

Calls 5

cboolFunction · 0.85
MakeGitErrorFunction · 0.85
newReferenceFromCFunction · 0.85
freeMethod · 0.80
BranchMethod · 0.80

Tested by

no test coverage detected