summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-02-23 22:56:04 +0100
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-02-23 23:00:45 +0100
commit82ccb87ef6b861ce681a869e1b8e0928e6b5f3fb (patch)
treeaa9efe087bb6131e9815a72e4651504e12923b78 /src/tree.c
parentf01fa26690d28efe9f73daf81d0ba11b2b77ccbc (diff)
downloadlibgit2-82ccb87ef6b861ce681a869e1b8e0928e6b5f3fb.tar.gz
tree: break out on write error
If write_tree() returs an error, we used to set the error message and continued looping. Exit the loop so we return the error.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tree.c b/src/tree.c
index aeef67701..19681e3d5 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -363,6 +363,7 @@ static int write_tree(
written = write_tree(&sub_oid, repo, index, subdir, i);
if (written < 0) {
error = git__rethrow(written, "Failed to write subtree %s", subdir);
+ goto cleanup;
} else {
i = written - 1; /* -1 because of the loop increment */
}