Re: SEGV in git-merge recursive:
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Mar 29, 2007, 19:34 UTC
- Message-ID
- <Pine.LNX.4.64.0703291232190.6730@woody.linux-foundation.org>
- In-Reply-To
- <20070329183237.GB2809@steel.home>
On Thu, 29 Mar 2007, Alex Riesen wrote:
> > tree == 0x0? Strange, I don't get why it is NULL, the initial commit > definitely hase a tree (git cat-file -p initial-commit shows a tree > name and there is a tree with that object name).
It's not the initial commit. It's a criss-cross merge, and it's a virtual commit created by a previous level of merging.
Apply this patch to see it blow up much earlier, when that bogus commit with a NULL tree is created.
(I didn't debug *why* that happens, but maybe this gets somebody further)
Linus
--- merge-recursive.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c index c96e1a7..28f0c30 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -34,6 +34,7 @@ static struct commit *make_virtual_commit(struct tree *tree, const char *comment { struct commit *commit = xcalloc(1, sizeof(struct commit)); static unsigned virtual_id = 1; + assert(tree); commit->tree = tree; commit->util = (void*)comment; *(int*)commit->object.sha1 = virtual_id++;