Commit cdb6c1c83dd6f0d30b798a7f62d4f3849a1f11a1

Edward Thomson 2015-10-26T17:14:28

merge: add a second-level recursive merge

diff --git a/tests/merge/trees/recursive.c b/tests/merge/trees/recursive.c
index 1d35861..a7358e7 100644
--- a/tests/merge/trees/recursive.c
+++ b/tests/merge/trees/recursive.c
@@ -88,8 +88,6 @@ void test_merge_trees_recursive__two_norecursive(void)
 	git_index *index;
 	git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
 
-	opts.flags |= GIT_MERGE_NO_RECURSIVE;
-
 	struct merge_index_entry merge_index_entries[] = {
 		{ 0100644, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", 0, "asparagus.txt" },
 		{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
@@ -101,6 +99,8 @@ void test_merge_trees_recursive__two_norecursive(void)
 		{ 0100644, "4e21d2d63357bde5027d1625f5ec6b430cdeb143", 3, "veal.txt" },
 	};
 
+	opts.flags |= GIT_MERGE_NO_RECURSIVE;
+
 	cl_git_pass(merge_commits_from_branches(&index, repo, "branchB-1", "branchB-2", &opts));
 
 	cl_assert(merge_test_index(index, merge_index_entries, 8));
@@ -108,3 +108,49 @@ void test_merge_trees_recursive__two_norecursive(void)
 	git_index_free(index);
 }
 
+void test_merge_trees_recursive__three(void)
+{
+	git_index *index;
+	git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
+
+	struct merge_index_entry merge_index_entries[] = {
+		{ 0100644, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", 0, "asparagus.txt" },
+		{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
+		{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
+		{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
+		{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
+		{ 0100644, "15faa0c9991f2d65686e844651faa2ff9827887b", 0, "veal.txt" },
+	};
+
+	cl_git_pass(merge_commits_from_branches(&index, repo, "branchC-1", "branchC-2", &opts));
+
+	cl_assert(merge_test_index(index, merge_index_entries, 6));
+
+	git_index_free(index);
+}
+
+void test_merge_trees_recursive__three_norecursive(void)
+{
+	git_index *index;
+	git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
+
+	struct merge_index_entry merge_index_entries[] = {
+		{ 0100644, "ffb36e513f5fdf8a6ba850a20142676a2ac4807d", 0, "asparagus.txt" },
+		{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
+		{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
+		{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
+		{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
+		{ 0100644, "b2a81ead9e722af0099fccfb478cea88eea749a2", 1, "veal.txt" },
+		{ 0100644, "898d12687fb35be271c27c795a6b32c8b51da79e", 2, "veal.txt" },
+		{ 0100644, "68a2e1ee61a23a4728fe6b35580fbbbf729df370", 3, "veal.txt" },
+	};
+
+	opts.flags |= GIT_MERGE_NO_RECURSIVE;
+
+	cl_git_pass(merge_commits_from_branches(&index, repo, "branchC-1", "branchC-2", &opts));
+
+	cl_assert(merge_test_index(index, merge_index_entries, 8));
+
+	git_index_free(index);
+}
+
diff --git a/tests/resources/merge-recursive/.gitted/objects/0f/a6ead2731b9d138afe38c336c9727ea05027a7 b/tests/resources/merge-recursive/.gitted/objects/0f/a6ead2731b9d138afe38c336c9727ea05027a7
new file mode 100644
index 0000000..b06362d
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/0f/a6ead2731b9d138afe38c336c9727ea05027a7
@@ -0,0 +1 @@
+xJAE+*hk"bhTw8̴-\0/2<݌nKI\9D`5Tdϩ4JmI)ꈼ"-鄱晴O'„3YG	JAXSd#(NPxzmpg{q>e9ѱsӞ3=Y1pFe2oz
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/41/71bb8d40e9fc830d79b757dc06ec6c14548b78 b/tests/resources/merge-recursive/.gitted/objects/41/71bb8d40e9fc830d79b757dc06ec6c14548b78
new file mode 100644
index 0000000..5dc102d
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/41/71bb8d40e9fc830d79b757dc06ec6c14548b78 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/4e/70a6b06fc62481f80fbb74327849e7170eebff b/tests/resources/merge-recursive/.gitted/objects/4e/70a6b06fc62481f80fbb74327849e7170eebff
new file mode 100644
index 0000000..1dfcec5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/4e/70a6b06fc62481f80fbb74327849e7170eebff differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/68/a2e1ee61a23a4728fe6b35580fbbbf729df370 b/tests/resources/merge-recursive/.gitted/objects/68/a2e1ee61a23a4728fe6b35580fbbbf729df370
new file mode 100644
index 0000000..6d7c948
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/68/a2e1ee61a23a4728fe6b35580fbbbf729df370 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/75/c653822173a8e5795153ec3773dfe44bb9bb63 b/tests/resources/merge-recursive/.gitted/objects/75/c653822173a8e5795153ec3773dfe44bb9bb63
new file mode 100644
index 0000000..1495f70
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/75/c653822173a8e5795153ec3773dfe44bb9bb63
@@ -0,0 +1 @@
+xJ1);ՑLfrYdfSFbwヿm@WcRyh5V<H}@,3NFhI^-ŤuDA"1y!-N6Aߥ+<m{m;ؑ~;*~um- sȳwٱsӑ3=Z6NpGeOp<
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/81/5b5a1c80ca749d705c7aa0cb294a00cbedd340 b/tests/resources/merge-recursive/.gitted/objects/81/5b5a1c80ca749d705c7aa0cb294a00cbedd340
new file mode 100644
index 0000000..12eb066
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/81/5b5a1c80ca749d705c7aa0cb294a00cbedd340
@@ -0,0 +1,5 @@
+xK
+1D]}|:
@`Hx}G^ARw32t99^e/sFǙId9{ 5^kE&x4[e
'Cd̈11:#sZ
+}G[_ۧVUD)F7ވږK
+l
+e6Rb
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/89/8d12687fb35be271c27c795a6b32c8b51da79e b/tests/resources/merge-recursive/.gitted/objects/89/8d12687fb35be271c27c795a6b32c8b51da79e
new file mode 100644
index 0000000..2ce4f7f
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/89/8d12687fb35be271c27c795a6b32c8b51da79e differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/ad/2ace9e15f66b3d1138922e6ffdc3ea3f967fa6 b/tests/resources/merge-recursive/.gitted/objects/ad/2ace9e15f66b3d1138922e6ffdc3ea3f967fa6
new file mode 100644
index 0000000..8ae3ba5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/ad/2ace9e15f66b3d1138922e6ffdc3ea3f967fa6 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/c0/bd078a61d2cc22c52ca5ce04abdcdc5cc1829e b/tests/resources/merge-recursive/.gitted/objects/c0/bd078a61d2cc22c52ca5ce04abdcdc5cc1829e
new file mode 100644
index 0000000..3dde6c2
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/c0/bd078a61d2cc22c52ca5ce04abdcdc5cc1829e differ
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchC-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchC-1
new file mode 100644
index 0000000..346b039
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchC-1
@@ -0,0 +1 @@
+ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchC-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchC-2
new file mode 100644
index 0000000..67f3153
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchC-2
@@ -0,0 +1 @@
+815b5a1c80ca749d705c7aa0cb294a00cbedd340