summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2016-11-14 12:44:52 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2016-11-14 12:44:52 +0100
commit8977658519835805af5327e51f5a84354417839d (patch)
treee8dba4b17059f3516e7ac6910381a292b8080dc2 /src
parentb85929c523d7e61ba76715199831ec05089dc844 (diff)
downloadlibgit2-cmn/tree-updater-ordering.tar.gz
tree: look for conflicts in the new tree when updatingcmn/tree-updater-ordering
We look at whether we're trying to replace a blob with a tree during the update phase, but we fail to look at whether we've just inserted a blob where we're now trying to insert a tree. Update the check to look at both places. The test for this was previously succeeding due to the bu where we did not look at the sorted output.
Diffstat (limited to 'src')
-rw-r--r--src/tree.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tree.c b/src/tree.c
index b67b16249..9655ad739 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -1200,6 +1200,9 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
last = git_array_last(stack);
entry = last->tree ? git_tree_entry_byname(last->tree, component.ptr) : NULL;
+ if (!entry)
+ entry = treebuilder_get(last->bld, component.ptr);
+
if (entry && git_tree_entry_type(entry) != GIT_OBJ_TREE) {
giterr_set(GITERR_TREE, "D/F conflict when updating tree");
error = -1;