summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-11-08 17:39:23 +0100
committernulltoken <emeric.fermas@gmail.com>2012-11-09 16:45:47 +0100
commitf92bcaea499611bf0e6a71e845a2d74c790ea659 (patch)
treeaa210a84f473a864470de8ab6e0b54635b245714 /src
parent7cc1bf0fcb6de212dc50e02ff187880af9103bf4 (diff)
downloadlibgit2-f92bcaea499611bf0e6a71e845a2d74c790ea659.tar.gz
index: prevent tree creation from a non merged state
Fix libgit2/libgit2sharp#243
Diffstat (limited to 'src')
-rw-r--r--src/tree.c6
1 files changed, 6 insertions, 0 deletions
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;