Skip to content

Commit 8977658

Browse files
committed
tree: look for conflicts in the new tree when updating
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.
1 parent b85929c commit 8977658

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/tree.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,9 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
12001200

12011201
last = git_array_last(stack);
12021202
entry = last->tree ? git_tree_entry_byname(last->tree, component.ptr) : NULL;
1203+
if (!entry)
1204+
entry = treebuilder_get(last->bld, component.ptr);
1205+
12031206
if (entry && git_tree_entry_type(entry) != GIT_OBJ_TREE) {
12041207
giterr_set(GITERR_TREE, "D/F conflict when updating tree");
12051208
error = -1;

0 commit comments

Comments
 (0)