merge-tree: handle directory/empty conflict correctly
authorJohn Keeping <john@keeping.me.uk>
Mon, 6 May 2013 15:20:54 +0000 (16:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 7 May 2013 05:17:00 +0000 (22:17 -0700)
commit94883b4302118fe6ea50028d02bb453c9af38b66
tree720fe7f32b19b31a4ebf48469c0bff77e57a1c1d
parentab5f42422d7e025c3151d91cc5ec0d20b9a80922
merge-tree: handle directory/empty conflict correctly

git-merge-tree causes a null pointer dereference when a directory
entry exists in only one or two of the three trees being compared with
no corresponding entry in the other tree(s).

When this happens, we want to handle the entry as a directory and not
attempt to mark it as a file merge.  Do this by setting the entries bit
in the directory mask when the entry is missing or when it is a
directory, only performing the file comparison when we know that a file
entry exists.

Reported-by: Andreas Jacobsen <andreas@andreasjacobsen.com>
Signed-off-by: John Keeping <john@keeping.me.uk>
Tested-by: Andreas Jacobsen <andreas@andreasjacobsen.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/merge-tree.c
t/t4300-merge-tree.sh