From 82ccb87ef6b861ce681a869e1b8e0928e6b5f3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 23 Feb 2012 22:56:04 +0100 Subject: [PATCH] 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. --- src/tree.c | 1 + 1 file changed, 1 insertion(+) 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 */ }