[PATCH 2/3] merge-recursive: make empty tree a known object
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 9, 2006, 23:56 UTC
- Message-ID
- <Pine.LNX.4.63.0612100055390.28348@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <20061207101707.GA19139@spearce.org>
To use it in diff_tree_sha1(), a tree has to be hashed in the global object collection. This actually moves the empty tree (if it is needed) into the global object hash.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> --- merge-recursive.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c index 6e13b8e..280f23c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1220,9 +1220,10 @@ static int merge(struct commit *h1, /* if there is no common ancestor, make an empty tree */ struct tree *tree = xcalloc(1, sizeof(struct tree)); + hash_sha1_file(NULL, 0, tree_type, tree->object.sha1); + created_object(tree->object.sha1, &tree->object); tree->object.parsed = 1; tree->object.type = OBJ_TREE; - hash_sha1_file(NULL, 0, tree_type, tree->object.sha1); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); }
-- 1.4.4.2.g0f32-dirty