diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-22 03:29:05 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-08-22 03:29:05 +0200 |
commit | 2ed3474ab8e52c98a87e390d5128d45d693a115d (patch) | |
tree | 6f136c2508c22f6b5146ef08c49821a45a5f2357 /cshared | |
parent | 5b13c1a2e55cb442484d9c7b45389f422b110eec (diff) | |
download | go-git-2ed3474ab8e52c98a87e390d5128d45d693a115d.tar.gz |
ForEach review and Commit.Tree err return
Diffstat (limited to 'cshared')
-rw-r--r-- | cshared/commit_cshared.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cshared/commit_cshared.go b/cshared/commit_cshared.go index e73fb4a..8cb91aa 100644 --- a/cshared/commit_cshared.go +++ b/cshared/commit_cshared.go @@ -62,7 +62,11 @@ func c_Commit_Tree(c uint64) uint64 { return IH } commit := obj.(*git.Commit) - tree := commit.Tree() + tree, err := commit.Tree() + if err != nil { + return IH + } + tree_handle := RegisterObject(tree) return uint64(tree_handle) } @@ -156,14 +160,14 @@ func c_Commit_References(c uint64, path string) (*C.char, int, int, *C.char) { return nil, 0, ErrorCodeInternal, C.CString(err.Error()) } handles := make([]uint64, len(refs)) - for i, c := range(refs) { + for i, c := range refs { handles[i] = uint64(RegisterObject(c)) } size := 8 * len(handles) dest := C.malloc(C.size_t(size)) header := (*reflect.SliceHeader)(unsafe.Pointer(&handles)) header.Len *= 8 - copy((*[1<<30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header))) + copy((*[1 << 30]byte)(dest)[:], *(*[]byte)(unsafe.Pointer(header))) return (*C.char)(dest), size / 8, ErrorCodeSuccess, nil } |