summaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
Diffstat (limited to 'index.go')
-rw-r--r--index.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/index.go b/index.go
index 48c922c..dcb2780 100644
--- a/index.go
+++ b/index.go
@@ -10,13 +10,12 @@ extern int _go_git_index_remove_all(git_index*, const git_strarray*, void*);
*/
import "C"
import (
- "errors"
"fmt"
"runtime"
"unsafe"
)
-type IndexMatchedPathCallback func(string, string) int
+type IndexMatchedPathCallback func(string, string) error
type indexMatchedPathCallbackData struct {
callback IndexMatchedPathCallback
errorTarget *error
@@ -343,9 +342,9 @@ func indexMatchedPathCallback(cPath, cMatchedPathspec *C.char, payload unsafe.Po
panic("invalid matched path callback")
}
- ret := data.callback(C.GoString(cPath), C.GoString(cMatchedPathspec))
- if ret < 0 {
- *data.errorTarget = errors.New(ErrorCode(ret).String())
+ err := data.callback(C.GoString(cPath), C.GoString(cMatchedPathspec))
+ if err != nil {
+ *data.errorTarget = err
return C.int(ErrorCodeUser)
}