Make it possible to use a git2go error as a return value from a diff callback and have it propagate
This commit is contained in:
parent
fff6c9d8ae
commit
7f3d112fbe
6
diff.go
6
diff.go
|
@ -878,6 +878,9 @@ func hunkApplyCallback(_hunk *C.git_diff_hunk, _payload unsafe.Pointer) C.int {
|
||||||
|
|
||||||
apply, err := opts.ApplyHunkCallback(&hunk)
|
apply, err := opts.ApplyHunkCallback(&hunk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if gitError, ok := err.(*GitError); ok {
|
||||||
|
return C.int(gitError.Code)
|
||||||
|
}
|
||||||
return -1
|
return -1
|
||||||
} else if apply {
|
} else if apply {
|
||||||
return 0
|
return 0
|
||||||
|
@ -901,6 +904,9 @@ func deltaApplyCallback(_delta *C.git_diff_delta, _payload unsafe.Pointer) C.int
|
||||||
|
|
||||||
apply, err := opts.ApplyDeltaCallback(&delta)
|
apply, err := opts.ApplyDeltaCallback(&delta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if gitError, ok := err.(*GitError); ok {
|
||||||
|
return C.int(gitError.Code)
|
||||||
|
}
|
||||||
return -1
|
return -1
|
||||||
} else if apply {
|
} else if apply {
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in New Issue