summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.go6
-rw-r--r--submodule.go2
-rw-r--r--tree.go2
3 files changed, 4 insertions, 6 deletions
diff --git a/index.go b/index.go
index c344bf8..c1bfb74 100644
--- a/index.go
+++ b/index.go
@@ -234,12 +234,10 @@ func (v *Index) RemoveAll(pathspecs []string, callback IndexMatchedPathCallback)
//export indexMatchedPathCallback
func indexMatchedPathCallback(cPath, cMatchedPathspec *C.char, payload unsafe.Pointer) int {
- if payload == nil {
- return 0
- } else if callback, ok := pointerHandles.Get(payload).(IndexMatchedPathCallback); ok {
+ if callback, ok := pointerHandles.Get(payload).(IndexMatchedPathCallback); ok {
return callback(C.GoString(cPath), C.GoString(cMatchedPathspec))
} else {
- return -1
+ panic("invalid matched path callback")
}
}
diff --git a/submodule.go b/submodule.go
index 0588ec5..3882462 100644
--- a/submodule.go
+++ b/submodule.go
@@ -103,7 +103,7 @@ func SubmoduleVisitor(csub unsafe.Pointer, name *C.char, handle unsafe.Pointer)
if callback, ok := pointerHandles.Get(handle).(SubmoduleCbk); ok {
return (C.int)(callback(sub, C.GoString(name)))
} else {
- return -1
+ panic("invalid submodule visitor callback")
}
}
diff --git a/tree.go b/tree.go
index 70a3a3f..cbba08b 100644
--- a/tree.go
+++ b/tree.go
@@ -97,7 +97,7 @@ func CallbackGitTreeWalk(_root unsafe.Pointer, _entry unsafe.Pointer, ptr unsafe
if callback, ok := pointerHandles.Get(ptr).(TreeWalkCallback); ok {
return C.int(callback(root, newTreeEntry(entry)))
} else {
- return C.int(-1)
+ panic("invalid treewalk callback")
}
}