diff options
author | John Keeping <john@keeping.me.uk> | 2013-05-06 16:20:54 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-05-06 22:17:00 -0700 |
commit | 94883b4302118fe6ea50028d02bb453c9af38b66 (patch) | |
tree | 720fe7f32b19b31a4ebf48469c0bff77e57a1c1d /builtin | |
parent | ab5f42422d7e025c3151d91cc5ec0d20b9a80922 (diff) | |
download | git-94883b4302118fe6ea50028d02bb453c9af38b66.tar.gz |
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>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/merge-tree.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index ec49917a36..61cbde4094 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -251,7 +251,11 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3]) for (i = 0; i < 3; i++) { mask |= (1 << i); - if (n[i].mode && S_ISDIR(n[i].mode)) + /* + * Treat missing entries as directories so that we return + * after unresolved_directory has handled this. + */ + if (!n[i].mode || S_ISDIR(n[i].mode)) dirmask |= (1 << i); } |