]> git.proxmox.com Git - libgit2.git/blobdiff - tests/merge/trees/trivial.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / tests / merge / trees / trivial.c
index 2de187bf4c5770d4e9290ca84c50b238625e75e3..dce392c863e5419da4c669515356d766f80f3923 100644 (file)
@@ -4,7 +4,7 @@
 #include "merge.h"
 #include "../merge_helpers.h"
 #include "refs.h"
-#include "fileops.h"
+#include "futils.h"
 #include "git2/sys/index.h"
 
 static git_repository *repo;
@@ -13,7 +13,7 @@ static git_repository *repo;
 #define TEST_INDEX_PATH TEST_REPO_PATH "/.git/index"
 
 
-// Fixture setup and teardown
+/* Fixture setup and teardown */
 void test_merge_trees_trivial__initialize(void)
 {
        repo = cl_git_sandbox_init(TEST_REPO_PATH);
@@ -30,15 +30,15 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs
        git_commit *our_commit, *their_commit, *ancestor_commit;
        git_tree *our_tree, *their_tree, *ancestor_tree;
        git_oid our_oid, their_oid, ancestor_oid;
-       git_buf branch_buf = GIT_BUF_INIT;
-       git_merge_tree_opts opts = GIT_MERGE_TREE_OPTS_INIT;
+       git_str branch_buf = GIT_STR_INIT;
+       git_merge_options opts = GIT_MERGE_OPTIONS_INIT;
 
-       git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours);
+       git_str_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours);
        cl_git_pass(git_reference_name_to_id(&our_oid, repo, branch_buf.ptr));
        cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
 
-       git_buf_clear(&branch_buf);
-       git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, theirs);
+       git_str_clear(&branch_buf);
+       git_str_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, theirs);
        cl_git_pass(git_reference_name_to_id(&their_oid, repo, branch_buf.ptr));
        cl_git_pass(git_commit_lookup(&their_commit, repo, &their_oid));
 
@@ -51,7 +51,7 @@ static int merge_trivial(git_index **index, const char *ours, const char *theirs
 
        cl_git_pass(git_merge_trees(index, repo, ancestor_tree, our_tree, their_tree, &opts));
 
-       git_buf_free(&branch_buf);
+       git_str_dispose(&branch_buf);
        git_tree_free(our_tree);
        git_tree_free(their_tree);
        git_tree_free(ancestor_tree);
@@ -71,7 +71,7 @@ static int merge_trivial_conflict_entrycount(git_index *index)
        for (i = 0; i < git_index_entrycount(index); i++) {
                cl_assert(entry = git_index_get_byindex(index, i));
 
-               if (git_index_entry_stage(entry) > 0)
+               if (git_index_entry_is_conflict(entry))
                        count++;
        }
 
@@ -259,7 +259,7 @@ void test_merge_trees_trivial__13(void)
 
        cl_assert(entry = git_index_get_bypath(result, "modified-in-13.txt", 0));
        cl_git_pass(git_oid_fromstr(&expected_oid, "1cff9ec6a47a537380dedfdd17c9e76d74259a2b"));
-       cl_assert(git_oid_cmp(&entry->oid, &expected_oid) == 0);
+       cl_assert_equal_oid(&expected_oid, &entry->id);
 
        cl_assert(git_index_reuc_entrycount(result) == 0);
        cl_assert(merge_trivial_conflict_entrycount(result) == 0);
@@ -278,7 +278,7 @@ void test_merge_trees_trivial__14(void)
 
        cl_assert(entry = git_index_get_bypath(result, "modified-in-14-branch.txt", 0));
        cl_git_pass(git_oid_fromstr(&expected_oid, "26153a3ff3649b6c2bb652d3f06878c6e0a172f9"));
-       cl_assert(git_oid_cmp(&entry->oid, &expected_oid) == 0);
+       cl_assert(git_oid_cmp(&entry->id, &expected_oid) == 0);
 
        cl_assert(git_index_reuc_entrycount(result) == 0);
        cl_assert(merge_trivial_conflict_entrycount(result) == 0);