Commit 651bfd69 by Edward Thomson Committed by Edward Thomson

recursive: test conflict output during recursive merge

parent dcde5720
......@@ -40,3 +40,33 @@
"this file is changed in master and branch\n" \
"this file is changed in branch and master\n"
#define CONFLICTING_RECURSIVE_F1_TO_F2 \
"VEAL SOUP.\n" \
"\n" \
"<<<<<<< HEAD\n" \
"PUT INTO A POT THREE QUARTS OF WATER, three onions cut small, ONE\n" \
"=======\n" \
"PUT INTO A POT THREE QUARTS OF WATER, three onions cut not too small, one\n" \
">>>>>>> branchF-2\n" \
"spoonful of black pepper pounded, and two of salt, with two or three\n" \
"slices of lean ham; let it boil steadily two hours; skim it\n" \
"occasionally, then put into it a shin of veal, let it boil two hours\n" \
"longer; take out the slices of ham, and skim off the grease if any\n" \
"should rise, take a gill of good cream, mix with it two table-spoonsful\n" \
"of flour very nicely, and the yelks of two eggs beaten well, strain this\n" \
"mixture, and add some chopped parsley; pour some soup on by degrees,\n" \
"stir it well, and pour it into the pot, continuing to stir until it has\n" \
"boiled two or three minutes to take off the raw taste of the eggs. If\n" \
"the cream be not perfectly sweet, and the eggs quite new, the thickening\n" \
"will curdle in the soup. For a change you may put a dozen ripe tomatos\n" \
"in, first taking off their skins, by letting them stand a few minutes in\n" \
"hot water, when they may be easily peeled. When made in this way you\n" \
"must thicken it with the flour only. Any part of the veal may be used,\n" \
"but the shin or knuckle is the nicest.\n" \
"\n" \
"<<<<<<< HEAD\n" \
"This certainly is a mighty fine recipe.\n" \
"=======\n" \
"This is a mighty fine recipe!\n" \
">>>>>>> branchF-2\n"
#include "clar_libgit2.h"
#include "git2/repository.h"
#include "git2/merge.h"
#include "merge.h"
#include "../merge_helpers.h"
#include "../conflict_data.h"
static git_repository *repo;
#define TEST_REPO_PATH "merge-recursive"
void test_merge_workdir_recursive__initialize(void)
{
repo = cl_git_sandbox_init(TEST_REPO_PATH);
}
void test_merge_workdir_recursive__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_merge_workdir_recursive__writes_conflict_with_virtual_base(void)
{
git_index *index;
git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
git_buf conflicting_buf = GIT_BUF_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, "fa567f568ed72157c0c617438d077695b99d9aac", 1, "veal.txt" },
{ 0100644, "21950d5e4e4d1a871b4dfcf72ecb6b9c162c434e", 2, "veal.txt" },
{ 0100644, "3855170cef875708da06ab9ad7fc6a73b531cda1", 3, "veal.txt" },
};
cl_git_pass(merge_branches(repo, GIT_REFS_HEADS_DIR "branchF-1", GIT_REFS_HEADS_DIR "branchF-2", &opts, NULL));
cl_git_pass(git_repository_index(&index, repo));
cl_assert(merge_test_index(index, merge_index_entries, 8));
cl_git_pass(git_futils_readbuffer(&conflicting_buf, "merge-recursive/veal.txt"));
cl_assert_equal_s(CONFLICTING_RECURSIVE_F1_TO_F2, conflicting_buf.ptr);
git_index_free(index);
git_buf_free(&conflicting_buf);
}
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