summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index df6762c3a..81b4d51df 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1060,11 +1060,13 @@ int git_path_direach(
if ((error = git_buf_put(path, de_path, de_len)) < 0)
break;
+ giterr_clear();
error = fn(arg, path);
git_buf_truncate(path, wd_len); /* restore path */
- if (error != 0) {
+ /* Only set our own error if the callback did not set one already */
+ if (error != 0 && !giterr_last()) {
giterr_set_after_callback(error);
break;
}