conflict tests: use GIT_IDXENTRY_STAGE_SET
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
diff --git a/tests/checkout/conflict.c b/tests/checkout/conflict.c
index 3d763af..006dc65 100644
--- a/tests/checkout/conflict.c
+++ b/tests/checkout/conflict.c
@@ -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;
diff --git a/tests/checkout/index.c b/tests/checkout/index.c
index de0770d..89b0145 100644
--- a/tests/checkout/index.c
+++ b/tests/checkout/index.c
@@ -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));
}
diff --git a/tests/checkout/tree.c b/tests/checkout/tree.c
index 50541a7..4623231 100644
--- a/tests/checkout/tree.c
+++ b/tests/checkout/tree.c
@@ -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));
diff --git a/tests/index/collision.c b/tests/index/collision.c
index 1f002e8..19c1548 100644
--- a/tests/index/collision.c
+++ b/tests/index/collision.c
@@ -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);
diff --git a/tests/index/conflicts.c b/tests/index/conflicts.c
index 3b38723..65f8ed5 100644
--- a/tests/index/conflicts.c
+++ b/tests/index/conflicts.c
@@ -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));
diff --git a/tests/object/tree/duplicateentries.c b/tests/object/tree/duplicateentries.c
index 65be12e..35dd383 100644
--- a/tests/object/tree/duplicateentries.c
+++ b/tests/object/tree/duplicateentries.c
@@ -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));
diff --git a/tests/reset/hard.c b/tests/reset/hard.c
index 86d4be2..88055ad 100644
--- a/tests/reset/hard.c
+++ b/tests/reset/hard.c
@@ -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);