diff options
| author | Aidan Nulman <[email protected]> | 2014-01-29 18:01:26 -0500 |
|---|---|---|
| committer | Aidan Nulman <[email protected]> | 2014-01-29 18:01:26 -0500 |
| commit | f66502aaf44862a8671285e80327d808afee155f (patch) | |
| tree | 53d207cf045ced480b5d8c3253017098b8860c6a /git.go | |
| parent | d8c3772e350f387bb55b74dc1d654d69bd66b69a (diff) | |
update git2go to support latest libgit2 development commit (id: 66af84)
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -9,8 +9,8 @@ import "C" import ( "bytes" "errors" - "unsafe" "strings" + "unsafe" ) const ( @@ -89,7 +89,7 @@ func (oid *Oid) Equal(oid2 *Oid) bool { } func (oid *Oid) IsZero() bool { - for _, a := range(oid.bytes) { + for _, a := range oid.bytes { if a != '0' { return false } @@ -123,10 +123,10 @@ func ShortenOids(ids []*Oid, minlen int) (int, error) { type GitError struct { Message string - Code int + Code int } -func (e GitError) Error() string{ +func (e GitError) Error() string { return e.Message } @@ -139,14 +139,14 @@ func LastError() error { } func cbool(b bool) C.int { - if (b) { + if b { return C.int(1) } return C.int(0) } func ucbool(b bool) C.uint { - if (b) { + if b { return C.uint(1) } return C.uint(0) @@ -159,13 +159,13 @@ func Discover(start string, across_fs bool, ceiling_dirs []string) (string, erro cstart := C.CString(start) defer C.free(unsafe.Pointer(cstart)) - retpath := (*C.char)(C.malloc(C.GIT_PATH_MAX)) - defer C.free(unsafe.Pointer(retpath)) + retpath := (*C.git_buf)(C.malloc(C.GIT_PATH_MAX)) + defer C.git_buf_free(retpath) - r := C.git_repository_discover(retpath, C.GIT_PATH_MAX, cstart, cbool(across_fs), ceildirs) + r := C.git_repository_discover(retpath, cstart, cbool(across_fs), ceildirs) if r == 0 { - return C.GoString(retpath), nil + return C.GoString(retpath.ptr), nil } return "", LastError() |
