From f92bcaea499611bf0e6a71e845a2d74c790ea659 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Thu, 8 Nov 2012 17:39:23 +0100 Subject: index: prevent tree creation from a non merged state Fix libgit2/libgit2sharp#243 --- src/tree.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/tree.c b/src/tree.c index 46b4a6dd1..7b47af347 100644 --- a/src/tree.c +++ b/src/tree.c @@ -497,6 +497,12 @@ int git_tree__write_index(git_oid *oid, git_index *index, git_repository *repo) assert(oid && index && repo); + if (git_index_has_conflicts(index)) { + giterr_set(GITERR_INDEX, + "Cannot create a tree from a not fully merged index."); + return GIT_EUNMERGED; + } + if (index->tree != NULL && index->tree->entries >= 0) { git_oid_cpy(oid, &index->tree->oid); return 0; -- cgit v1.2.1