Commit 86c8d02c by Edward Thomson Committed by Edward Thomson

merge: add simple recursive test

Add a simple recursive test - where multiple ancestors exist and
creating a virtual merge base from them would prevent a conflict.
parent fa78782f
......@@ -74,16 +74,24 @@ typedef enum {
GIT_MERGE_FIND_RENAMES = (1 << 0),
/**
* If a conflict occurs, exit immediately instead of attempting to
* continue resolving conflicts. The merge operation will fail with
* GIT_EMERGECONFLICT and no index will be returned.
*/
GIT_MERGE_FAIL_ON_CONFLICT = (1 << 1),
/**
* Do not write the REUC extension on the generated index
*/
GIT_MERGE_SKIP_REUC = (1 << 2),
/**
* If a conflict occurs, exit immediately instead of attempting to
* continue resolving conflicts. The merge operation will fail with
* GIT_EMERGECONFLICT and no index will be returned.
* If the commits being merged have multiple merge bases, do not build
* a recursive merge base (by merging the multiple merge bases),
* instead simply use the first base. This flag provides a similar
* merge base to `git-merge-resolve`.
*/
GIT_MERGE_FAIL_ON_CONFLICT = (1 << 1),
GIT_MERGE_NO_RECURSIVE = (1 << 3),
} git_merge_flag_t;
/**
......
......@@ -4,6 +4,7 @@
#include "tree.h"
#include "merge_helpers.h"
#include "merge.h"
#include "index.h"
#include "git2/merge.h"
#include "git2/sys/index.h"
#include "git2/annotated_commit.h"
......@@ -239,7 +240,7 @@ int merge_test_index(git_index *index, const struct merge_index_entry expected[]
const git_index_entry *index_entry;
/*
dump_index_entries(&index->entries);
merge__dump_index_entries(&index->entries);
*/
if (git_index_entrycount(index) != expected_len)
......
#include "clar_libgit2.h"
#include "git2/repository.h"
#include "git2/merge.h"
#include "merge.h"
#include "../merge_helpers.h"
static git_repository *repo;
#define TEST_REPO_PATH "merge-recursive"
void test_merge_trees_recursive__initialize(void)
{
repo = cl_git_sandbox_init(TEST_REPO_PATH);
}
void test_merge_trees_recursive__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_merge_trees_recursive__one(void)
{
git_index *index;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "dea7215f259b2cced87d1bda6c72f8b4ce37a2ff", 0, "asparagus.txt" },
{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
{ 0100644, "94d2c01087f48213bd157222d54edfefd77c9bba", 0, "veal.txt" },
};
cl_git_pass(merge_commits_from_branches(&index, repo, "branchA-1", "branchA-2", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 6));
git_index_free(index);
}
void test_merge_trees_recursive__one_norecursive(void)
{
git_index *index;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
struct merge_index_entry merge_index_entries[] = {
{ 0100644, "dea7215f259b2cced87d1bda6c72f8b4ce37a2ff", 0, "asparagus.txt" },
{ 0100644, "68f6182f4c85d39e1309d97c7e456156dc9c0096", 0, "beef.txt" },
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
{ 0100644, "94d2c01087f48213bd157222d54edfefd77c9bba", 0, "veal.txt" },
};
opts.flags |= GIT_MERGE_NO_RECURSIVE;
cl_git_pass(merge_commits_from_branches(&index, repo, "branchA-1", "branchA-2", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 6));
git_index_free(index);
}
void test_merge_trees_recursive__two(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, "666ffdfcf1eaa5641fa31064bf2607327e843c09", 0, "veal.txt" },
};
cl_git_pass(merge_commits_from_branches(&index, repo, "branchB-1", "branchB-2", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 6));
git_index_free(index);
}
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" },
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
{ 0100644, "cb49ad76147f5f9439cbd6133708b76142660660", 1, "veal.txt" },
{ 0100644, "b2a81ead9e722af0099fccfb478cea88eea749a2", 2, "veal.txt" },
{ 0100644, "4e21d2d63357bde5027d1625f5ec6b430cdeb143", 3, "veal.txt" },
};
cl_git_pass(merge_commits_from_branches(&index, repo, "branchB-1", "branchB-2", &opts));
cl_assert(merge_test_index(index, merge_index_entries, 8));
git_index_free(index);
}
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
7c7bf85e978f1d18c0566f702d2cb7766b9c8d4f refs/heads/master
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
fire with a piece of bacon, a large onion cut up, and pepper and salt;
add two quarts of water, boil them till the stalks are quite soft, then
pulp them through a sieve, and strain the water to it, which must be put
back in the pot; put into it a chicken cut up, with the tops of
asparagus which had been laid by, boil it until these last articles are
sufficiently done, thicken with flour, butter and milk, and serve it up.
BEEF SOUP.
Take the hind shin of beef, cut off all the flesh off the leg-bone,
which must be taken away entirely, or the soup will be greasy. Wash the
meat clean and lay it in a pot, sprinkle over it one small
table-spoonful of pounded black pepper, and two of salt; three onions
the size of a hen's egg, cut small, six small carrots scraped and cut
up, two small turnips pared and cut into dice; pour on three quarts of
water, cover the pot close, and keep it gently and steadily boiling five
hours, which will leave about three pints of clear soup; do not let the
pot boil over, but take off the scum carefully, as it rises. When it has
boiled four hours, put in a small bundle of thyme and parsley, and a
pint of celery cut small, or a tea-spoonful of celery seed pounded.
These latter ingredients would lose their delicate flavour if boiled too
much. Just before you take it up, brown it in the following manner: put
a small table-spoonful of nice brown sugar into an iron skillet, set it
on the fire and stir it till it melts and looks very dark, pour into it
a ladle full of the soup, a little at a time; stirring it all the while.
Strain this browning and mix it well with the soup; take out the bundle
of thyme and parsley, put the nicest pieces of meat in your tureen, and
pour on the soup and vegetables; put in some toasted bread cut in dice,
and serve it up.
SOUP WITH BOUILLI.
Take the nicest part of the thick brisket of beef, about eight pounds,
put it into a pot with every thing directed for the other soup; make it
exactly in the same way, only put it on an hour sooner, that you may
have time to prepare the bouilli; after it has boiled five hours, take
out the beef, cover up the soup and set it near the fire that it may
keep hot. Take the skin off the beef, have the yelk of an egg well
beaten, dip a feather in it and wash the top of your beef, sprinkle over
it the crumb of stale bread finely grated, put it in a Dutch oven
previously heated, put the top on with coals enough to brown, but not
burn the beef; let it stand nearly an hour, and prepare your gravy
thus:--Take a sufficient quantity of soup and the vegetables boiled in
it; add to it a table-spoonful of red wine, and two of mushroom catsup,
thicken with a little bit of butter and a little brown flour; make it
very hot, pour it in your dish, and put the beef on it. Garnish it with
green pickle, cut in thin slices, serve up the soup in a tureen with
bits of toasted bread.
GRAVY SOUP.
Get eight pounds of coarse lean beef--wash it clean and lay it in your
pot, put in the same ingredients as for the shin soup, with the same
quantity of water, and follow the process directed for that. Strain the
soup through a sieve, and serve it up clear, with nothing more than
toasted bread in it; two table-spoonsful of mushroom catsup will add a
fine flavour to the 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
and salt; boil it till reduced one-half, strain it through a sieve,
return the liquid into the pot, put in one quart of fresh oysters, boil
it till they are sufficiently done, and thicken the soup with four
spoonsful of flour, two gills of rich cream, and the yelks of six new
laid eggs beaten well; boil it a few minutes after the thickening is put
in. Take care that it does not curdle, and that the flour is not in
lumps; serve it up with the last oysters that were put in. If the
flavour of thyme be agreeable, you may put in a little, but take care
that it does not boil in it long enough to discolour the soup.
VEAL SOUP!
Put into a pot three quarts of water, three 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
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,
stir it well, and pour it into the pot, continuing to stir until it has
boiled two or three minutes to take off the raw taste of the eggs. If
the cream be not perfectly sweet, and the eggs quite new, the thickening
will curdle in the soup. For a change you may put a dozen ripe tomatos
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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment