summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-06-06 03:55:28 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-06 03:55:28 +0200
commit8da44047050c16b563575cf973c1f33b6149f1cc (patch)
treee714d8e1ef4313156cb8d996092abca8d4e1f5de /src/path.c
parentbabdc376c7a0ed698ada5f0512789bd99a8b2c4a (diff)
downloadlibgit2-8da44047050c16b563575cf973c1f33b6149f1cc.tar.gz
path: error out if the callback returns an errorcmn/foreach-cancel-loose
When the callback returns an error, we should stop immediately. This broke when trying to make sure we pass specific errors up the chain. This broke cancelling out of the loose backend's foreach.
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/path.c b/src/path.c
index 81b4d51df..8f861e68e 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1066,8 +1066,10 @@ int git_path_direach(
git_buf_truncate(path, wd_len); /* restore path */
/* Only set our own error if the callback did not set one already */
- if (error != 0 && !giterr_last()) {
- giterr_set_after_callback(error);
+ if (error != 0) {
+ if (!giterr_last())
+ giterr_set_after_callback(error);
+
break;
}
}