Before overwriting the destination index, first let's discard its
contents.

Signed-off-by: Felipe Contreras <felipe.contre...@gmail.com>
---
 unpack-trees.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 57b4074..abe2576 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1166,8 +1166,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, 
struct unpack_trees_options
 
        o->src_index = NULL;
        ret = check_updates(o) ? (-2) : 0;
-       if (o->dst_index)
+       if (o->dst_index) {
+               discard_index(o->dst_index);
                *o->dst_index = o->result;
+       }
 
 done:
        clear_exclude_list(&el);
-- 
1.8.3.698.g079b096

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to