summaryrefslogtreecommitdiff
path: root/branch.go
diff options
context:
space:
mode:
authorCarlos Martín Nieto <[email protected]>2015-03-15 01:49:32 +0100
committerCarlos Martín Nieto <[email protected]>2015-03-15 01:49:32 +0100
commitc4fce1a218fd33938c0be90e939531c0a00ebf7f (patch)
tree40cf7f6c0331050db5f841ddfd6738951f482f66 /branch.go
parent050e6fbc49ac1a173af5e3462b3c2d330cadd113 (diff)
Update to libgit2 d675982a153
There's been some changes to the checkout strategy, especially the SAFE_CREATE mode, which is now the RECREATE_MISSING flag, though that shouldn't be necessary to use in the general case. The largest changes come from the removal of the signture from ref-modifying functions/methods and the removal of the reflog string in all but those directly related to moving references.
Diffstat (limited to 'branch.go')
-rw-r--r--branch.go36
1 files changed, 4 insertions, 32 deletions
diff --git a/branch.go b/branch.go
index 22b767e..0daa99d 100644
--- a/branch.go
+++ b/branch.go
@@ -90,30 +90,16 @@ func (repo *Repository) NewBranchIterator(flags BranchType) (*BranchIterator, er
return newBranchIteratorFromC(repo, ptr), nil
}
-func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool, signature *Signature, msg string) (*Branch, error) {
+func (repo *Repository) CreateBranch(branchName string, target *Commit, force bool) (*Branch, error) {
ref := new(Reference)
cBranchName := C.CString(branchName)
cForce := cbool(force)
- cSignature, err := signature.toC()
- if err != nil {
- return nil, err
- }
- defer C.git_signature_free(cSignature)
-
- var cmsg *C.char
- if msg == "" {
- cmsg = nil
- } else {
- cmsg = C.CString(msg)
- defer C.free(unsafe.Pointer(cmsg))
- }
-
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_branch_create(&ref.ptr, repo.ptr, cBranchName, target.cast_ptr, cForce, cSignature, cmsg)
+ ret := C.git_branch_create(&ref.ptr, repo.ptr, cBranchName, target.cast_ptr, cForce)
if ret < 0 {
return nil, MakeGitError(ret)
}
@@ -131,29 +117,15 @@ func (b *Branch) Delete() error {
return nil
}
-func (b *Branch) Move(newBranchName string, force bool, signature *Signature, msg string) (*Branch, error) {
+func (b *Branch) Move(newBranchName string, force bool) (*Branch, error) {
var ptr *C.git_reference
cNewBranchName := C.CString(newBranchName)
cForce := cbool(force)
- cSignature, err := signature.toC()
- if err != nil {
- return nil, err
- }
- defer C.git_signature_free(cSignature)
-
- var cmsg *C.char
- if msg == "" {
- cmsg = nil
- } else {
- cmsg = C.CString(msg)
- defer C.free(unsafe.Pointer(cmsg))
- }
-
runtime.LockOSThread()
defer runtime.UnlockOSThread()
- ret := C.git_branch_move(&ptr, b.Reference.ptr, cNewBranchName, cForce, cSignature, cmsg)
+ ret := C.git_branch_move(&ptr, b.Reference.ptr, cNewBranchName, cForce)
if ret < 0 {
return nil, MakeGitError(ret)
}