aboutsummaryrefslogtreecommitdiff
path: root/submodule.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-10-13 08:59:05 -0400
committerJunio C Hamano <gitster@pobox.com>2011-10-13 10:18:16 -0700
commit80988783c8c417c5e914256b43ed3604cc8fa4c3 (patch)
treee59001bc21004d07a0a9904d2703cf916b98f0af /submodule.c
parent72251b7de6daf2cd7916e3aad46df0047e5a5d2b (diff)
downloadgit-80988783c8c417c5e914256b43ed3604cc8fa4c3.tar.gz
git-80988783c8c417c5e914256b43ed3604cc8fa4c3.tar.xz
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>
Diffstat (limited to 'submodule.c')
-rw-r--r--submodule.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c
index 0b709bc29..0fd10a0fd 100644
--- a/submodule.c
+++ b/submodule.c
@@ -794,7 +794,7 @@ static void print_commit(struct commit *commit)
int merge_submodule(unsigned char result[20], const char *path,
const unsigned char base[20], const unsigned char a[20],
- const unsigned char b[20])
+ const unsigned char b[20], int search)
{
struct commit *commit_base, *commit_a, *commit_b;
int parent_count;
@@ -849,6 +849,10 @@ int merge_submodule(unsigned char result[20], const char *path,
* user needs to confirm the resolution.
*/
+ /* Skip the search if makes no sense to the calling context. */
+ if (!search)
+ return 0;
+
/* find commit which merges them */
parent_count = find_first_merges(&merges, path, commit_a, commit_b);
switch (parent_count) {