submodule: Search for merges only at end of recursive merge

The submodule merge search is not useful during virtual merges because
the results cannot be used automatically.  Furthermore any suggestions
made by the search may apply to commits different than HEAD:sub and
MERGE_HEAD:sub, thus confusing the user.  Skip searching for submodule
merges during a virtual merge such as that between B and C while merging
the heads of:

    B---BC
   / \ /
  A   X
   \ / \
    C---CB

Run the search only when the recursion level is zero (!o->call_depth).
This fixes known breakage tested in t7405-submodule-merge.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Brad King
2011-10-13 08:59:05 -04:00
committed by Junio C Hamano
parent 72251b7de6
commit 80988783c8
4 changed files with 11 additions and 5 deletions

View File

@ -946,8 +946,10 @@ static struct merge_file_info merge_file_1(struct merge_options *o,
free(result_buf.ptr);
result.clean = (merge_status == 0);
} else if (S_ISGITLINK(a->mode)) {
result.clean = merge_submodule(result.sha, one->path, one->sha1,
a->sha1, b->sha1);
result.clean = merge_submodule(result.sha,
one->path, one->sha1,
a->sha1, b->sha1,
!o->call_depth);
} else if (S_ISLNK(a->mode)) {
hashcpy(result.sha, a->sha1);