Shawn Pearce <spearce@xxxxxxxxxxx> writes: > I found the above error message in tree-diff.c's diff_tree_sha1 > function. I threw in debugging and found that the new tree was > the root tree of one branch and the base was the root tree of some > other revision. > > Apparently the empty tree is being created in merge-recursive.c: > > 1219 if (merged_common_ancestors == NULL) { > 1220 /* if there is no common ancestor, make an empty tree */ > 1221 struct tree *tree = xcalloc(1, sizeof(struct tree)); > 1222 > 1223 tree->object.parsed = 1; > 1224 tree->object.type = OBJ_TREE; > 1225 hash_sha1_file(NULL, 0, tree_type, tree->object.sha1); > 1226 merged_common_ancestors = make_virtual_commit(tree, "ancestor"); > 1227 } > > So basically this code crashes if its ever used in a repository > that hasn't had a need for the empty tree before. :-( I hit the same issue when I integrated Johannes's in-core merge; I originally used hash_sha1_file() but that results in objects that are supposed to be in the virtual parent unreadable when merging the real children. The key is to use write_sha1_file() to actually create the needed objects, and trust later prune to remove them. Replace it with write_sha1_file() and you should be fine, I think. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html