merge-recursive: allow write_tree_from_memory() to error out

It is possible that a tree cannot be written (think: disk full). We will want to give the caller a chance to clean up instead of letting the program die() in such a case. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jul 26, 2016 at 18:06 UTC fbc87eb54409b5c7b080f1c23b767daefc9d6ede
1 file changed +2 -2
merge-recursive.c
+2 -2
@@ -1888,8 +1888,8 @@ int merge_trees(struct merge_options *o,
1888 else
1889 clean = 1;
1890
1891 - if (o->call_depth)
1892 - *result = write_tree_from_memory(o);
1891 + if (o->call_depth && !(*result = write_tree_from_memory(o)))
1892 + return -1;
1893
1894 return clean;
1895 }