* [PATCH] merge-recur: if there is no common ancestor, fake empty one
@ 2006-08-09 16:43 Johannes Schindelin
2006-08-09 17:44 ` Johannes Schindelin
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2006-08-09 16:43 UTC (permalink / raw)
To: git, junkio
This fixes the coolest merge ever.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
This was a forgotten part from the python version.
merge-recursive.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 7a93dd9..f5b547b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1223,6 +1223,18 @@ int merge(struct commit *h1,
output_commit_title(iter->item);
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));
+ char buffer[40];
+ int hdrlen;
+
+ tree->object.parsed = 1;
+ tree->object.type = OBJ_TREE;
+ *write_sha1_file_prepare(NULL, 0, tree_type, &tree->object.sha1,
+ buffer, &hdrlen);
+ merged_common_ancestors = make_virtual_commit(tree, "ancestor");
+ }
for (iter = ca; iter; iter = iter->next) {
output_indent = call_depth + 1;
--
1.4.2.rc3.g29d0-dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] merge-recur: if there is no common ancestor, fake empty one
2006-08-09 16:43 [PATCH] merge-recur: if there is no common ancestor, fake empty one Johannes Schindelin
@ 2006-08-09 17:44 ` Johannes Schindelin
2006-08-09 19:55 ` Alex Riesen
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Schindelin @ 2006-08-09 17:44 UTC (permalink / raw)
To: git, junkio
Hi,
On Wed, 9 Aug 2006, Johannes Schindelin wrote:
> + *write_sha1_file_prepare(NULL, 0, tree_type, &tree->object.sha1,
... make this "tree->object.sha1" _without_ a "&", of course.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] merge-recur: if there is no common ancestor, fake empty one
2006-08-09 17:44 ` Johannes Schindelin
@ 2006-08-09 19:55 ` Alex Riesen
0 siblings, 0 replies; 3+ messages in thread
From: Alex Riesen @ 2006-08-09 19:55 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, junkio
Johannes Schindelin, Wed, Aug 09, 2006 19:44:38 +0200:
>
> > + *write_sha1_file_prepare(NULL, 0, tree_type, &tree->object.sha1,
>
> ... make this "tree->object.sha1" _without_ a "&", of course.
>
And without the asterisk before write_sha1_file_prepare
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-09 19:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-09 16:43 [PATCH] merge-recur: if there is no common ancestor, fake empty one Johannes Schindelin
2006-08-09 17:44 ` Johannes Schindelin
2006-08-09 19:55 ` Alex Riesen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox