Commit a200bcf72838488c1550b1709a3f075f722e0244

Edward Thomson 2015-10-26T17:25:42

merge: add a third-level recursive merge

diff --git a/tests/merge/trees/recursive.c b/tests/merge/trees/recursive.c
index a7358e7..cd87967 100644
--- a/tests/merge/trees/recursive.c
+++ b/tests/merge/trees/recursive.c
@@ -154,3 +154,49 @@ void test_merge_trees_recursive__three_norecursive(void)
 	git_index_free(index);
 }
 
+void test_merge_trees_recursive__four(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, "d55e5dc038c52f1a36548625bcb666cbc06db9e6", 0, "veal.txt" },
+	};
+
+	cl_git_pass(merge_commits_from_branches(&index, repo, "branchD-2", "branchD-1", &opts));
+
+	cl_assert(merge_test_index(index, merge_index_entries, 6));
+
+	git_index_free(index);
+}
+
+void test_merge_trees_recursive__four_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, "898d12687fb35be271c27c795a6b32c8b51da79e", 1, "veal.txt" },
+		{ 0100644, "f1b44c04989a3a1c14b036cfadfa328d53a7bc5e", 2, "veal.txt" },
+		{ 0100644, "5e8747f5200fac0f945a07daf6163ca9cb1a8da9", 3, "veal.txt" },
+	};
+
+	opts.flags |= GIT_MERGE_NO_RECURSIVE;
+
+	cl_git_pass(merge_commits_from_branches(&index, repo, "branchD-2", "branchD-1", &opts));
+
+	cl_assert(merge_test_index(index, merge_index_entries, 8));
+
+	git_index_free(index);
+}
+
diff --git a/tests/resources/merge-recursive/.gitted/objects/00/7f1ee2af8e5d99906867c4237510e1790a89b8 b/tests/resources/merge-recursive/.gitted/objects/00/7f1ee2af8e5d99906867c4237510e1790a89b8
new file mode 100644
index 0000000..d9399d7
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/00/7f1ee2af8e5d99906867c4237510e1790a89b8
@@ -0,0 +1,3 @@
+xNI
+1<FtgA<zY:LFBjj-I]߈fah
+R)<+΅sZd8Fkg$RQqe!&ZgRg_.nK
N
~j[=2ց28;vsfTrqa<
`bQ
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/15/faa0c9991f2d65686e844651faa2ff9827887b b/tests/resources/merge-recursive/.gitted/objects/15/faa0c9991f2d65686e844651faa2ff9827887b
new file mode 100644
index 0000000..54cd6f2
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/15/faa0c9991f2d65686e844651faa2ff9827887b differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/4d/fc1be85a9d6c9898152444d32b238b4aecf8cc b/tests/resources/merge-recursive/.gitted/objects/4d/fc1be85a9d6c9898152444d32b238b4aecf8cc
new file mode 100644
index 0000000..9db684d
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/4d/fc1be85a9d6c9898152444d32b238b4aecf8cc differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/50/e4facaafb746cfed89287206274193c1417288 b/tests/resources/merge-recursive/.gitted/objects/50/e4facaafb746cfed89287206274193c1417288
new file mode 100644
index 0000000..b1eaee5
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/50/e4facaafb746cfed89287206274193c1417288
@@ -0,0 +1,2 @@
+x+)JMU022g040031QH,.H,JL/-+(a9/>~WENYZGj
+RSj2I^'y51i0599`e5az%潎U^XV	Vtٙo]2Y~P1($bz7g\QdLɔ3RsjD-89S^75#-ע3;\
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/5e/8747f5200fac0f945a07daf6163ca9cb1a8da9 b/tests/resources/merge-recursive/.gitted/objects/5e/8747f5200fac0f945a07daf6163ca9cb1a8da9
new file mode 100644
index 0000000..fa1c9e5
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/5e/8747f5200fac0f945a07daf6163ca9cb1a8da9 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/5f/18576d464946eb2338daeb8b4030019961f505 b/tests/resources/merge-recursive/.gitted/objects/5f/18576d464946eb2338daeb8b4030019961f505
new file mode 100644
index 0000000..d03742b
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/5f/18576d464946eb2338daeb8b4030019961f505 differ
diff --git a/tests/resources/merge-recursive/.gitted/objects/ad/1ea02c2cc4f55c1dff87b80a086206a73885eb b/tests/resources/merge-recursive/.gitted/objects/ad/1ea02c2cc4f55c1dff87b80a086206a73885eb
new file mode 100644
index 0000000..99207a9
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/ad/1ea02c2cc4f55c1dff87b80a086206a73885eb
@@ -0,0 +1,2 @@
+x+)JMU022g040031QH,.H,JL/-+(a9/>~WENYZGj
+RSj2I^'y51i0599`e5az%潎U^XV	Vtٙo]2Y~P1($bz7g\QdLɔ3Rsjݿ*~뛘R+<[{
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/ca/49d1a8b6116ffeba22667bba265fa5261df7ab b/tests/resources/merge-recursive/.gitted/objects/ca/49d1a8b6116ffeba22667bba265fa5261df7ab
new file mode 100644
index 0000000..1ea5967
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/ca/49d1a8b6116ffeba22667bba265fa5261df7ab
@@ -0,0 +1,2 @@
+xN1D+8q^BH:{ݠ^=gFھ_8FWo*s]#ZR)Zl$N0ڔzbY4+
+VCE9>_=$#)hDf#fN-őYmlCy^ikk;F'Twel[@"2Yp6d2,71ˣg48	.hv>d?;No
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/e1/dcfc3038be54195a59817c89782b261e46cb05 b/tests/resources/merge-recursive/.gitted/objects/e1/dcfc3038be54195a59817c89782b261e46cb05
new file mode 100644
index 0000000..3668b54
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/objects/e1/dcfc3038be54195a59817c89782b261e46cb05
@@ -0,0 +1 @@
+xN1:O:%/uݠ\OGTG5ܶ2yw7x-X1pM`#ؠ6%F]œᤙ"HyI)8Կy*X_CX\1VB9JAX[Aڶk$Rg>ܶ{nD2ZQk5Yn0hn,UV8e
N;G>>MpM
\ No newline at end of file
diff --git a/tests/resources/merge-recursive/.gitted/objects/f1/b44c04989a3a1c14b036cfadfa328d53a7bc5e b/tests/resources/merge-recursive/.gitted/objects/f1/b44c04989a3a1c14b036cfadfa328d53a7bc5e
new file mode 100644
index 0000000..7cbaaee
Binary files /dev/null and b/tests/resources/merge-recursive/.gitted/objects/f1/b44c04989a3a1c14b036cfadfa328d53a7bc5e differ
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchD-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchD-1
new file mode 100644
index 0000000..fa96ccb
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchD-1
@@ -0,0 +1 @@
+4dfc1be85a9d6c9898152444d32b238b4aecf8cc
diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchD-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchD-2
new file mode 100644
index 0000000..8a87f98
--- /dev/null
+++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchD-2
@@ -0,0 +1 @@
+007f1ee2af8e5d99906867c4237510e1790a89b8