aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2006-12-07 05:17:07 -0500
committerJunio C Hamano <junkio@cox.net>2006-12-11 14:11:40 -0800
commit9abd46a3471c2d58976e06a00e937b03672b98bc (patch)
tree859e5f21abe7fb5376217b0aa7435827d4abfa51
parent554a2636f7c5125a83bb07194632445467d46c83 (diff)
downloadgit-9abd46a3471c2d58976e06a00e937b03672b98bc.tar.gz
git-9abd46a3471c2d58976e06a00e937b03672b98bc.tar.xz
Make sure the empty tree exists when needed in merge-recursive.
There are some baseless merge cases where git-merge-recursive will try to compare one of the branches against the empty tree. However most projects won't have the empty tree object in their object database as Git does not normally create empty tree objects. If the empty tree object is missing then the merge process will die, as it cannot load the object from the database. The error message may make the user think that their database is corrupt when its actually not. So instead we should just create the empty tree object whenever it is needed. If the object already exists as a loose object then no harm done. Otherwise that loose object will be pruned away later by either git-prune or git-prune-packed. Thanks goes to Junio for suggesting this fix. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--merge-recursive.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index cd2cc77bf..32e186c15 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1238,7 +1238,7 @@ static int merge(struct commit *h1,
tree->object.parsed = 1;
tree->object.type = OBJ_TREE;
- hash_sha1_file(NULL, 0, tree_type, tree->object.sha1);
+ write_sha1_file(NULL, 0, tree_type, tree->object.sha1);
merged_common_ancestors = make_virtual_commit(tree, "ancestor");
}