| 99 | } |
| 100 | |
| 101 | func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool) (*Branch, error) { |
| 102 | |
| 103 | var ptr *C.git_reference |
| 104 | cBranchName := C.CString(branchName) |
| 105 | defer C.free(unsafe.Pointer(cBranchName)) |
| 106 | cForce := cbool(force) |
| 107 | |
| 108 | runtime.LockOSThread() |
| 109 | defer runtime.UnlockOSThread() |
| 110 | |
| 111 | ret := C.git_branch_create(&ptr, repo.ptr, cBranchName, target.cast_ptr, cForce) |
| 112 | runtime.KeepAlive(repo) |
| 113 | runtime.KeepAlive(target) |
| 114 | if ret < 0 { |
| 115 | return nil, MakeGitError(ret) |
| 116 | } |
| 117 | return newReferenceFromC(ptr, repo).Branch(), nil |
| 118 | } |
| 119 | |
| 120 | func (b *Branch) Delete() error { |
| 121 | |