summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 127f045)
raw | patch | inline | side by side (parent: 127f045)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Tue, 16 Aug 2011 18:27:39 +0000 (13:27 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 16 Aug 2011 20:06:13 +0000 (13:06 -0700) |
When this code was first written (v1.4.3-rc1~174^2~4, merge-recur: if
there is no common ancestor, fake empty one, 2006-08-09), everyone
needing a fake empty tree had to make her own, but ever since
v1.5.5-rc0~180^2~1 (2008-02-13), the object lookup machinery provides
a ready-made one. Use it.
This is just a simplification, though it also fixes a small leak
(since the tree in the virtual common ancestor commit is never freed).
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
there is no common ancestor, fake empty one, 2006-08-09), everyone
needing a fake empty tree had to make her own, but ever since
v1.5.5-rc0~180^2~1 (2008-02-13), the object lookup machinery provides
a ready-made one. Use it.
This is just a simplification, though it also fixes a small leak
(since the tree in the virtual common ancestor commit is never freed).
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c | patch | blob | history |
diff --git a/merge-recursive.c b/merge-recursive.c
index 206c1036359ce7b1fc5a1f5734b2d0bc2a760d90..7695fe89196521a339ef422678f7ed3cb078cb38 100644 (file)
--- a/merge-recursive.c
+++ b/merge-recursive.c
merged_common_ancestors = pop_commit(&ca);
if (merged_common_ancestors == NULL) {
- /* if there is no common ancestor, make an empty tree */
- struct tree *tree = xcalloc(1, sizeof(struct tree));
+ /* if there is no common ancestor, use an empty tree */
+ struct tree *tree;
- tree->object.parsed = 1;
- tree->object.type = OBJ_TREE;
- pretend_sha1_file(NULL, 0, OBJ_TREE, tree->object.sha1);
+ tree = lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN);
merged_common_ancestors = make_virtual_commit(tree, "ancestor");
}