Commit 2f1080ea by Edward Thomson

conflict tests: use GIT_IDXENTRY_STAGE_SET

parent 191e97a0
......@@ -102,7 +102,7 @@ static void create_index(struct checkout_index_entry *entries, size_t entries_le
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = entries[i].mode;
entry.flags = entries[i].stage << GIT_IDXENTRY_STAGESHIFT;
GIT_IDXENTRY_STAGE_SET(&entry, entries[i].stage);
git_oid_fromstr(&entry.id, entries[i].oid_str);
entry.path = entries[i].path;
......
......@@ -685,15 +685,15 @@ static void add_conflict(git_index *index, const char *path)
entry.path = path;
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
entry.flags = (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "4e886e602529caa9ab11d71f86634bd1b6e0de10");
entry.flags = (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
entry.flags = (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(index, &entry));
}
......
......@@ -893,16 +893,16 @@ static void create_conflict(const char *path)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = 0100644;
entry.flags = 1 << GIT_IDXENTRY_STAGESHIFT;
GIT_IDXENTRY_STAGE_SET(&entry, 1);
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
entry.path = path;
cl_git_pass(git_index_add(index, &entry));
entry.flags = 2 << GIT_IDXENTRY_STAGESHIFT;
GIT_IDXENTRY_STAGE_SET(&entry, 2);
git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
cl_git_pass(git_index_add(index, &entry));
entry.flags = 3 << GIT_IDXENTRY_STAGESHIFT;
GIT_IDXENTRY_STAGE_SET(&entry, 3);
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
cl_git_pass(git_index_add(index, &entry));
......
......@@ -57,7 +57,7 @@ void test_index_collision__add_with_highstage_1(void)
git_oid_fromstr(&entry.id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
entry.path = "a/b";
entry.flags = (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
/* create a blob beneath the previous tree entry */
......@@ -67,7 +67,7 @@ void test_index_collision__add_with_highstage_1(void)
/* create another tree entry above the blob */
entry.path = "a/b";
entry.flags = (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
git_index_free(index);
......@@ -89,17 +89,17 @@ void test_index_collision__add_with_highstage_2(void)
git_oid_fromstr(&entry.id, "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
entry.path = "a/b/c";
entry.flags = (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
/* create a blob beneath the previous tree entry */
entry.path = "a/b/c";
entry.flags = (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
/* create another tree entry above the blob */
entry.path = "a/b";
entry.flags = (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(index, &entry));
git_index_free(index);
......
......@@ -48,17 +48,17 @@ void test_index_conflicts__add(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, TEST_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
ancestor_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, TEST_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 2);
git_oid_fromstr(&their_entry.id, TEST_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -79,17 +79,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, TEST_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, TEST_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
ancestor_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, TEST_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -123,17 +123,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, TEST_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
our_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, TEST_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
their_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, TEST_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -329,7 +329,7 @@ void test_index_conflicts__partial(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, TEST_ANCESTOR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, NULL, NULL));
......
......@@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry.path = "duplicate";
ancestor_entry.mode = GIT_FILEMODE_BLOB;
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6");
our_entry.path = "duplicate";
our_entry.mode = GIT_FILEMODE_BLOB;
ancestor_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057");
their_entry.path = "duplicate";
their_entry.mode = GIT_FILEMODE_BLOB;
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&their_entry, 3);
git_oid_fromstr(&their_entry.id, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd");
cl_git_pass(git_index_conflict_add(index, &ancestor_entry, &our_entry, &their_entry));
......
......@@ -108,7 +108,7 @@ static void index_entry_init(git_index *index, int side, git_oid *oid)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.path = "conflicting_file";
entry.flags = (side << GIT_IDXENTRY_STAGESHIFT);
GIT_IDXENTRY_STAGE_SET(&entry, side);
entry.mode = 0100644;
git_oid_cpy(&entry.id, oid);
......
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