summaryrefslogtreecommitdiff
path: root/builtin/merge-tree.c
diff options
context:
space:
mode:
authorWill Palmer <wmpalmer@gmail.com>2010-07-14 18:04:07 +0100
committerJunio C Hamano <gitster@pobox.com>2010-07-14 12:56:49 -0700
commit21baa6e0c56d229866c02c4b42b8b53af648d853 (patch)
tree0f651d69beff4fdcdde40754d0deb8ef8caf0714 /builtin/merge-tree.c
parentf32e9852d40e26da0c042ca35bf07fa456c9832b (diff)
downloadgit-21baa6e0c56d229866c02c4b42b8b53af648d853.tar.gz
merge-tree: fix where two branches share no changes
15b4f7a (merge-tree: use ll_merge() not xdl_merge(), 2010-01-16) introduced a regression to merge-tree to cause it to segfault when merging files which existed in one branch, but not in the other or in the merge-base. This was caused by referencing entry->path at a time when entry was known to be possibly-NULL. To correct the problem, we save the path of the entry we came in with, as the path should be the same among all the stages no matter which sides are involved in the merge. Signed-off-by: Will Palmer <wmpalmer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge-tree.c')
-rw-r--r--builtin/merge-tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index fc00d794d6..9b25ddc979 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -60,6 +60,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
{
enum object_type type;
struct blob *base, *our, *their;
+ const char *path = entry->path;
if (!entry->stage)
return read_sha1_file(entry->blob->object.sha1, &type, size);
@@ -76,7 +77,7 @@ static void *result(struct merge_list *entry, unsigned long *size)
their = NULL;
if (entry)
their = entry->blob;
- return merge_file(entry->path, base, our, their, size);
+ return merge_file(path, base, our, their, size);
}
static void *origin(struct merge_list *entry, unsigned long *size)