diff options
| author | Aidan Nulman <[email protected]> | 2014-02-24 03:05:44 -0500 |
|---|---|---|
| committer | Aidan Nulman <[email protected]> | 2014-02-24 03:05:44 -0500 |
| commit | 2656a72e823e16451480b7858213f6e3cb8bb2fd (patch) | |
| tree | e31656bc81965c4d18864d8305f2f6ff65fd627a /git.go | |
| parent | decaf064f9ace275789657343d5123ee5290ea31 (diff) | |
| parent | c6d1bde37cc7f3bd213fc182fd9f60a7cd685419 (diff) | |
Merge branch 'master' into custom_odb
Conflicts:
git.go
reference.go
repository.go
submodule.go
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -10,8 +10,8 @@ import ( "bytes" "errors" "runtime" - "strings" "unsafe" + "strings" ) const ( @@ -167,17 +167,16 @@ func Discover(start string, across_fs bool, ceiling_dirs []string) (string, erro cstart := C.CString(start) defer C.free(unsafe.Pointer(cstart)) - retpath := (*C.git_buf)(C.malloc(C.GIT_PATH_MAX)) - defer C.git_buf_free(retpath) + var buf C.git_buf + defer C.git_buf_free(&buf) runtime.LockOSThread() defer runtime.UnlockOSThread() - r := C.git_repository_discover(retpath, cstart, cbool(across_fs), ceildirs) - - if r == 0 { - return C.GoString(retpath.ptr), nil + ret := C.git_repository_discover(&buf, cstart, cbool(across_fs), ceildirs) + if ret < 0 { + return "", LastError() } - return "", LastError() + return C.GoString(buf.ptr), nil } |
