diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-11-09 19:55:26 +0300 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-11-25 23:38:33 +0300 |
commit | 34a51428a121800509c2bea94137a17802e37982 (patch) | |
tree | 0bb471f67596dabca0fd9c2c2934947d52c4f048 | |
parent | 651bfd699c8eaa8ca36de0d0d992a1832d71df8f (diff) |
merge tests: add complex recursive example
-rw-r--r-- | tests/merge/trees/recursive.c | 28 | ||||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/HEAD | 2 | ||||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/index | bin | 632 -> 619 bytes | |||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/objects/34/8f16ffaeb73f319a75cec5b16a0a47d2d5e27c | bin | 0 -> 208 bytes | |||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/objects/48/3065df53c0f4a02cdc6b2910b05d388fc17ffb | bin | 0 -> 165 bytes | |||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/objects/c4/83ca4bb087174af5cb51d7caa9c09fe4a28ccb | 1 | ||||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/objects/d7/1c24b3b113fd1d1909998c5bfe33b86a65ee03 | bin | 0 -> 240 bytes | |||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/refs/heads/branchG-1 | 1 | ||||
-rw-r--r-- | tests/resources/merge-recursive/.gitted/refs/heads/branchG-2 | 1 | ||||
-rw-r--r-- | tests/resources/merge-recursive/asparagus.txt | 2 | ||||
-rw-r--r-- | tests/resources/merge-recursive/oyster.txt | 2 | ||||
-rw-r--r-- | tests/resources/merge-recursive/veal.txt | 8 |
12 files changed, 39 insertions, 6 deletions
diff --git a/tests/merge/trees/recursive.c b/tests/merge/trees/recursive.c index abca01727..1e5f61391 100644 --- a/tests/merge/trees/recursive.c +++ b/tests/merge/trees/recursive.c @@ -269,3 +269,31 @@ void test_merge_trees_recursive__conflict(void) git_index_free(index); } +/* + * Branch G-1 and G-2 have three common ancestors (815b5a1, ad2ace9, 483065d). + * The merge-base of the first two has two common ancestors (723181f, a34e5a1) + * which themselves have two common ancestors (8f35f30, 3a3f5a6), which + * finally has a common ancestor of 7c7bf85. This virtual merge base will + * be computed and merged with 483065d which also has a common ancestor of + * 7c7bf85. + */ +void test_merge_trees_recursive__oh_so_many_levels_of_recursion(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, "7c7e08f9559d9e1551b91e1cf68f1d0066109add", 0, "oyster.txt" }, + { 0100644, "898d12687fb35be271c27c795a6b32c8b51da79e", 0, "veal.txt" }, + }; + + cl_git_pass(merge_commits_from_branches(&index, repo, "branchG-1", "branchG-2", &opts)); + + cl_assert(merge_test_index(index, merge_index_entries, 6)); + + git_index_free(index); +} diff --git a/tests/resources/merge-recursive/.gitted/HEAD b/tests/resources/merge-recursive/.gitted/HEAD index 77e35742d..d7cef11aa 100644 --- a/tests/resources/merge-recursive/.gitted/HEAD +++ b/tests/resources/merge-recursive/.gitted/HEAD @@ -1 +1 @@ -ref: refs/heads/branchB-1 +ref: refs/heads/branchG-2 diff --git a/tests/resources/merge-recursive/.gitted/index b/tests/resources/merge-recursive/.gitted/index Binary files differindex 1e47851a5..571cfd02f 100644 --- a/tests/resources/merge-recursive/.gitted/index +++ b/tests/resources/merge-recursive/.gitted/index diff --git a/tests/resources/merge-recursive/.gitted/objects/34/8f16ffaeb73f319a75cec5b16a0a47d2d5e27c b/tests/resources/merge-recursive/.gitted/objects/34/8f16ffaeb73f319a75cec5b16a0a47d2d5e27c Binary files differnew file mode 100644 index 000000000..bd1b1f69a --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/34/8f16ffaeb73f319a75cec5b16a0a47d2d5e27c diff --git a/tests/resources/merge-recursive/.gitted/objects/48/3065df53c0f4a02cdc6b2910b05d388fc17ffb b/tests/resources/merge-recursive/.gitted/objects/48/3065df53c0f4a02cdc6b2910b05d388fc17ffb Binary files differnew file mode 100644 index 000000000..298251b3c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/48/3065df53c0f4a02cdc6b2910b05d388fc17ffb diff --git a/tests/resources/merge-recursive/.gitted/objects/c4/83ca4bb087174af5cb51d7caa9c09fe4a28ccb b/tests/resources/merge-recursive/.gitted/objects/c4/83ca4bb087174af5cb51d7caa9c09fe4a28ccb new file mode 100644 index 000000000..643a98280 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/c4/83ca4bb087174af5cb51d7caa9c09fe4a28ccb @@ -0,0 +1 @@ +xPKN@cS̮d#!+v\ d[E}E\`۱lɼ-0.cW5熱5Қ\sX(V#$V;g1Hy±ڂP!HmzXb-X \^)\+15WP!g`JHw~Uy㘷<'b^m9oӮ~y\-o˽AdC2}C3g3 GCq;zl<{
\ No newline at end of file diff --git a/tests/resources/merge-recursive/.gitted/objects/d7/1c24b3b113fd1d1909998c5bfe33b86a65ee03 b/tests/resources/merge-recursive/.gitted/objects/d7/1c24b3b113fd1d1909998c5bfe33b86a65ee03 Binary files differnew file mode 100644 index 000000000..66720086c --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/objects/d7/1c24b3b113fd1d1909998c5bfe33b86a65ee03 diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchG-1 b/tests/resources/merge-recursive/.gitted/refs/heads/branchG-1 new file mode 100644 index 000000000..af511439b --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchG-1 @@ -0,0 +1 @@ +c483ca4bb087174af5cb51d7caa9c09fe4a28ccb diff --git a/tests/resources/merge-recursive/.gitted/refs/heads/branchG-2 b/tests/resources/merge-recursive/.gitted/refs/heads/branchG-2 new file mode 100644 index 000000000..24177a247 --- /dev/null +++ b/tests/resources/merge-recursive/.gitted/refs/heads/branchG-2 @@ -0,0 +1 @@ +d71c24b3b113fd1d1909998c5bfe33b86a65ee03 diff --git a/tests/resources/merge-recursive/asparagus.txt b/tests/resources/merge-recursive/asparagus.txt index f51658077..ffb36e513 100644 --- a/tests/resources/merge-recursive/asparagus.txt +++ b/tests/resources/merge-recursive/asparagus.txt @@ -1,4 +1,4 @@ -ASPARAGUS SOUP! +ASPARAGUS SOUP. Take four large bunches of asparagus, scrape it nicely, cut off one inch of the tops, and lay them in water, chop the stalks and put them on the diff --git a/tests/resources/merge-recursive/oyster.txt b/tests/resources/merge-recursive/oyster.txt index 68af1fc74..7c7e08f95 100644 --- a/tests/resources/merge-recursive/oyster.txt +++ b/tests/resources/merge-recursive/oyster.txt @@ -1,4 +1,4 @@ -OYSTER SOUP. +OYSTER SOUP! Wash and drain two quarts of oysters, put them on with three quarts of water, three onions chopped up, two or three slices of lean ham, pepper diff --git a/tests/resources/merge-recursive/veal.txt b/tests/resources/merge-recursive/veal.txt index 94d2c0108..898d12687 100644 --- a/tests/resources/merge-recursive/veal.txt +++ b/tests/resources/merge-recursive/veal.txt @@ -1,10 +1,10 @@ -VEAL SOUP! +VEAL SOUP. -Put into a pot three quarts of water, three onions cut small, one +PUT INTO A POT THREE QUARTS OF WATER, 3 onions cut small, ONE spoonful of black pepper pounded, and two of salt, with two or three slices of lean ham; let it boil steadily two hours; skim it occasionally, then put into it a shin of veal, let it boil two hours -longer. take out the slices of ham, and skim off the grease if any +longer; take out the slices of ham, and skim off the grease if any should rise, take a gill of good cream, mix with it two table-spoonsful of flour very nicely, and the yelks of two eggs beaten well, strain this mixture, and add some chopped parsley; pour some soup on by degrees, @@ -16,3 +16,5 @@ in, first taking off their skins, by letting them stand a few minutes in hot water, when they may be easily peeled. When made in this way you must thicken it with the flour only. Any part of the veal may be used, but the shin or knuckle is the nicest. + +This is a mighty fine recipe! |