Commit 18e71e6d by Edward Thomson

index: use new enum and structure names

Use the new-style index names throughout our own codebase.
parent 19faf7c5
......@@ -138,7 +138,7 @@ static int diff_delta__from_one(
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
has_old = !has_old;
if ((entry->flags & GIT_IDXENTRY_VALID) != 0)
if ((entry->flags & GIT_INDEX_ENTRY_VALID) != 0)
return 0;
if (status == GIT_DELTA_IGNORED &&
......@@ -764,11 +764,11 @@ static int maybe_modified(
status = GIT_DELTA_CONFLICTED;
/* support "assume unchanged" (poorly, b/c we still stat everything) */
} else if ((oitem->flags & GIT_IDXENTRY_VALID) != 0) {
} else if ((oitem->flags & GIT_INDEX_ENTRY_VALID) != 0) {
status = GIT_DELTA_UNMODIFIED;
/* support "skip worktree" index bit */
} else if ((oitem->flags_extended & GIT_IDXENTRY_SKIP_WORKTREE) != 0) {
} else if ((oitem->flags_extended & GIT_INDEX_ENTRY_SKIP_WORKTREE) != 0) {
status = GIT_DELTA_UNMODIFIED;
/* if basic type of file changed, then split into delete and add */
......
......@@ -23,11 +23,11 @@ static kh_inline khint_t idxentry_hash(const git_index_entry *e)
const char *s = e->path;
khint_t h = (khint_t)git__tolower(*s);
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (khint_t)git__tolower(*s);
return h + GIT_IDXENTRY_STAGE(e);
return h + GIT_INDEX_ENTRY_STAGE(e);
}
#define idxentry_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_IDXENTRY_STAGE(a) == GIT_IDXENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
#define idxentry_equal(a, b) (GIT_INDEX_ENTRY_STAGE(a) == GIT_INDEX_ENTRY_STAGE(b) && strcmp(a->path, b->path) == 0)
#define idxentry_icase_equal(a, b) (GIT_INDEX_ENTRY_STAGE(a) == GIT_INDEX_ENTRY_STAGE(b) && strcasecmp(a->path, b->path) == 0)
__KHASH_IMPL(idx, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_equal)
__KHASH_IMPL(idxicase, static kh_inline, const git_index_entry *, git_index_entry *, 1, idxentry_hash, idxentry_icase_equal)
......
......@@ -1186,7 +1186,8 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo)
git_index_free(index);
}
error = git_index_set_caps(repo->_index, GIT_INDEXCAP_FROM_OWNER);
error = git_index_set_caps(repo->_index,
GIT_INDEX_CAPABILITY_FROM_OWNER);
}
git_buf_dispose(&index_path);
......
......@@ -889,7 +889,7 @@ int git_submodule_add_to_index(git_submodule *sm, int write_index)
memset(&entry, 0, sizeof(entry));
entry.path = sm->path;
git_index_entry__init_from_stat(
&entry, &st, !(git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE));
&entry, &st, !(git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE));
/* calling git_submodule_open will have set sm->wd_oid if possible */
if ((sm->flags & GIT_SUBMODULE_STATUS__WD_OID_VALID) == 0) {
......
......@@ -13,7 +13,7 @@ static int iterator_compare(const git_index_entry *entry, void *_data)
struct iterator_compare_data *data = (struct iterator_compare_data *)_data;
cl_assert_equal_i(GIT_IDXENTRY_STAGE(entry), data->expected[data->idx].stage);
cl_assert_equal_i(GIT_INDEX_ENTRY_STAGE(entry), data->expected[data->idx].stage);
cl_git_pass(git_oid_fromstr(&expected_id, data->expected[data->idx].oid_str));
cl_assert_equal_oid(&entry->id, &expected_id);
cl_assert_equal_i(entry->mode, data->expected[data->idx].mode);
......@@ -75,7 +75,7 @@ static int iterator_eq(const git_index_entry **entry, void *_data)
if (!entry[0] || !entry[1])
return -1;
cl_assert_equal_i(GIT_IDXENTRY_STAGE(entry[0]), GIT_IDXENTRY_STAGE(entry[1]));
cl_assert_equal_i(GIT_INDEX_ENTRY_STAGE(entry[0]), GIT_INDEX_ENTRY_STAGE(entry[1]));
cl_assert_equal_oid(&entry[0]->id, &entry[1]->id);
cl_assert_equal_i(entry[0]->mode, entry[1]->mode);
cl_assert_equal_s(entry[0]->path, entry[1]->path);
......
......@@ -103,7 +103,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;
GIT_IDXENTRY_STAGE_SET(&entry, entries[i].stage);
GIT_INDEX_ENTRY_STAGE_SET(&entry, entries[i].stage);
git_oid_fromstr(&entry.id, entries[i].oid_str);
entry.path = entries[i].path;
......
......@@ -733,15 +733,15 @@ static void add_conflict(git_index *index, const char *path)
entry.path = path;
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "4e886e602529caa9ab11d71f86634bd1b6e0de10");
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(index, &entry));
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(index, &entry));
}
......
......@@ -941,16 +941,16 @@ static void create_conflict(const char *path)
memset(&entry, 0x0, sizeof(git_index_entry));
entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
git_oid_fromstr(&entry.id, "d427e0b2e138501a3d15cc376077a3631e15bd46");
entry.path = path;
cl_git_pass(git_index_add(index, &entry));
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
git_oid_fromstr(&entry.id, "ee3fa1b8c00aff7fe02065fdb50864bb0d932ccf");
cl_git_pass(git_index_add(index, &entry));
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
git_oid_fromstr(&entry.id, "2bd0a343aeef7a2cf0d158478966a6e587ff3863");
cl_git_pass(git_index_add(index, &entry));
......
......@@ -145,12 +145,12 @@ void test_diff_workdir__to_index_with_assume_unchanged(void)
cl_assert((iep = git_index_get_bypath(idx, "modified_file", 0)) != NULL);
memcpy(&ie, iep, sizeof(ie));
ie.flags |= GIT_IDXENTRY_VALID;
ie.flags |= GIT_INDEX_ENTRY_VALID;
cl_git_pass(git_index_add(idx, &ie));
cl_assert((iep = git_index_get_bypath(idx, "file_deleted", 0)) != NULL);
memcpy(&ie, iep, sizeof(ie));
ie.flags |= GIT_IDXENTRY_VALID;
ie.flags |= GIT_INDEX_ENTRY_VALID;
cl_git_pass(git_index_add(idx, &ie));
cl_git_pass(git_index_write(idx));
......@@ -749,7 +749,7 @@ void test_diff_workdir__filemode_changes_with_filemode_false(void)
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, NULL));
memset(&exp, 0, sizeof(exp));
cl_git_pass(git_diff_foreach(diff,
cl_git_pass(git_diff_foreach(diff,
diff_file_cb, diff_binary_cb, diff_hunk_cb, diff_line_cb, &exp));
cl_assert_equal_i(0, exp.files);
......
......@@ -285,7 +285,7 @@ void test_index_bypath__add_honors_conflict_mode(void)
cl_git_pass(git_index_remove_bypath(g_idx, "README.txt"));
for (stage = 1; stage <= 3; stage++) {
new_entry.flags = stage << GIT_IDXENTRY_STAGESHIFT;
new_entry.flags = stage << GIT_INDEX_ENTRY_STAGESHIFT;
cl_git_pass(git_index_add(g_idx, &new_entry));
}
......@@ -317,7 +317,7 @@ void test_index_bypath__add_honors_conflict_case(void)
cl_git_pass(git_index_remove_bypath(g_idx, "README.txt"));
for (stage = 1; stage <= 3; stage++) {
new_entry.flags = stage << GIT_IDXENTRY_STAGESHIFT;
new_entry.flags = stage << GIT_INDEX_ENTRY_STAGESHIFT;
cl_git_pass(git_index_add(g_idx, &new_entry));
}
......
......@@ -108,7 +108,7 @@ void test_index_collision__add_with_highstage_1(void)
git_oid_cpy(&entry.id, &g_empty_id);
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(g_index, &entry));
/* create a blob beneath the previous tree entry */
......@@ -118,7 +118,7 @@ void test_index_collision__add_with_highstage_1(void)
/* create another tree entry above the blob */
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(g_index, &entry));
}
......@@ -134,16 +134,16 @@ void test_index_collision__add_with_highstage_2(void)
git_oid_cpy(&entry.id, &g_empty_id);
entry.path = "a/b/c";
GIT_IDXENTRY_STAGE_SET(&entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 1);
cl_git_pass(git_index_add(g_index, &entry));
/* create a blob beneath the previous tree entry */
entry.path = "a/b/c";
GIT_IDXENTRY_STAGE_SET(&entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 2);
cl_git_pass(git_index_add(g_index, &entry));
/* create another tree entry above the blob */
entry.path = "a/b";
GIT_IDXENTRY_STAGE_SET(&entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 3);
cl_git_pass(git_index_add(g_index, &entry));
}
......@@ -36,17 +36,17 @@ void test_index_conflicts__add(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -67,17 +67,17 @@ void test_index_conflicts__add_fixes_incorrect_stage(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -110,17 +110,17 @@ void test_index_conflicts__add_detects_invalid_filemode(void)
for (i = 0; i < 3; i++) {
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
/* Corrupt the conflict entry's mode */
......@@ -150,17 +150,17 @@ void test_index_conflicts__add_removes_stage_zero(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 3);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 3);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
our_entry.path = "test-one.txt";
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 1);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
their_entry.path = "test-one.txt";
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&their_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, 2);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, &our_entry, &their_entry));
......@@ -356,7 +356,7 @@ void test_index_conflicts__partial(void)
ancestor_entry.path = "test-one.txt";
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
cl_git_pass(git_index_conflict_add(repo_index, &ancestor_entry, NULL, NULL));
......@@ -386,17 +386,17 @@ void test_index_conflicts__case_matters(void)
memset(&their_entry, 0x0, sizeof(git_index_entry));
ancestor_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
our_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = upper_case;
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
their_entry.mode = GIT_FILEMODE_BLOB;
......@@ -404,17 +404,17 @@ void test_index_conflicts__case_matters(void)
&ancestor_entry, &our_entry, &their_entry));
ancestor_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_TWO_ANCESTOR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
our_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&our_entry.id, CONFLICTS_TWO_OUR_OID);
ancestor_entry.mode = GIT_FILEMODE_BLOB;
their_entry.path = mixed_case;
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&their_entry.id, CONFLICTS_TWO_THEIR_OID);
their_entry.mode = GIT_FILEMODE_BLOB;
......
......@@ -78,7 +78,7 @@ void test_index_filemodes__untrusted(void)
cl_repo_set_bool(g_repo, "core.filemode", false);
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert((git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE) != 0);
cl_assert((git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE) != 0);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode("exec_off", "filemodes/exec_off.0", 0644);
......@@ -122,7 +122,7 @@ void test_index_filemodes__trusted(void)
cl_repo_set_bool(g_repo, "core.filemode", true);
cl_git_pass(git_repository_index(&index, g_repo));
cl_assert((git_index_caps(index) & GIT_INDEXCAP_NO_FILEMODE) == 0);
cl_assert((git_index_caps(index) & GIT_INDEX_CAPABILITY_NO_FILEMODE) == 0);
/* 1 - add 0644 over existing 0644 -> expect 0644 */
replace_file_with_mode("exec_off", "filemodes/exec_off.0", 0644);
......@@ -245,7 +245,7 @@ void test_index_filemodes__invalid(void)
cl_git_pass(git_index_add_bypath(index, "dummy-file.txt"));
cl_assert((dummy = git_index_get_bypath(index, "dummy-file.txt", 0)));
GIT_IDXENTRY_STAGE_SET(&entry, 0);
GIT_INDEX_ENTRY_STAGE_SET(&entry, 0);
entry.path = "foo";
entry.mode = GIT_OBJ_BLOB;
git_oid_cpy(&entry.id, &dummy->id);
......
......@@ -41,21 +41,21 @@ static void index_add_conflicts(void)
/* ancestor */
entry.path = conflict[0];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_ANCESTOR);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_ANCESTOR);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
/* ours */
entry.path = conflict[1];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_OURS);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_OURS);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
/* theirs */
entry.path = conflict[2];
entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_THEIRS);
GIT_INDEX_ENTRY_STAGE_SET(&entry, GIT_INDEX_STAGE_THEIRS);
git_oid_fromstr(&entry.id, "1f85ca51b8e0aac893a621b61a9c2661d6aa6d81");
cl_git_pass(git_index_add(repo_index, &entry));
}
......
......@@ -210,13 +210,13 @@ void test_index_racy__adding_to_index_is_uptodate(void)
/* ensure that they're all uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(GIT_IDXENTRY_UPTODATE, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(GIT_INDEX_ENTRY_UPTODATE, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_git_pass(git_index_write(index));
......@@ -237,13 +237,13 @@ void test_index_racy__reading_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_index_free(index);
}
......@@ -264,13 +264,13 @@ void test_index_racy__read_tree_clears_uptodate_bit(void)
/* ensure that no files are uptodate */
cl_assert((entry = git_index_get_bypath(index, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(index, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_tree_free(tree);
git_index_free(index);
......@@ -311,13 +311,13 @@ void test_index_racy__read_index_clears_uptodate_bit(void)
/* ensure that files brought in from the other index are not uptodate */
cl_assert((entry = git_index_get_bypath(newindex, "A", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(newindex, "B", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
cl_assert((entry = git_index_get_bypath(newindex, "C", 0)));
cl_assert_equal_i(0, (entry->flags_extended & GIT_IDXENTRY_UPTODATE));
cl_assert_equal_i(0, (entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE));
git_index_free(index);
git_index_free(newindex);
......
......@@ -147,17 +147,17 @@ static void add_conflicts(git_index *index, const char *filename)
ancestor_entry.path = filename;
ancestor_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, ancestor_ids[conflict_idx]);
our_entry.path = filename;
our_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, our_ids[conflict_idx]);
their_entry.path = filename;
their_entry.mode = 0100644;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 2);
git_oid_fromstr(&their_entry.id, their_ids[conflict_idx]);
cl_git_pass(git_index_conflict_add(index, &ancestor_entry,
......
......@@ -129,12 +129,12 @@ void test_index_reuc__ignore_case(void)
index_caps = git_index_caps(repo_index);
index_caps &= ~GIT_INDEXCAP_IGNORE_CASE;
index_caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
cl_assert(!git_index_reuc_get_bypath(repo_index, "TWO.txt"));
index_caps |= GIT_INDEXCAP_IGNORE_CASE;
index_caps |= GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
cl_assert_equal_i(2, git_index_reuc_entrycount(repo_index));
......@@ -197,7 +197,7 @@ void test_index_reuc__updates_existing(void)
index_caps = git_index_caps(repo_index);
index_caps |= GIT_INDEXCAP_IGNORE_CASE;
index_caps |= GIT_INDEX_CAPABILITY_IGNORE_CASE;
cl_git_pass(git_index_set_caps(repo_index, index_caps));
git_oid_fromstr(&ancestor_oid, TWO_ANCESTOR_OID);
......
......@@ -810,7 +810,7 @@ void test_index_tests__preserves_case(void)
cl_git_rewritefile("myrepo/TEST.txt", "hello again\n");
cl_git_pass(git_index_add_bypath(index, "TEST.txt"));
if (index_caps & GIT_INDEXCAP_IGNORE_CASE)
if (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE)
cl_assert_equal_i(1, (int)git_index_entrycount(index));
else
cl_assert_equal_i(2, (int)git_index_entrycount(index));
......@@ -821,7 +821,7 @@ void test_index_tests__preserves_case(void)
cl_assert(git__strcmp(entry->path, "test.txt") == 0);
cl_assert((entry = git_index_get_bypath(index, "TEST.txt", 0)) != NULL);
if (index_caps & GIT_INDEXCAP_IGNORE_CASE)
if (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE)
/* The path should *not* have changed without an explicit remove */
cl_assert(git__strcmp(entry->path, "test.txt") == 0);
else
......@@ -923,13 +923,13 @@ void test_index_tests__reload_while_ignoring_case(void)
cl_git_pass(git_vector_verify_sorted(&index->entries));
caps = git_index_caps(index);
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_git_pass(git_index_read(index, true));
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(git_index_get_bypath(index, ".HEADER", 0));
cl_assert_equal_p(NULL, git_index_get_bypath(index, ".header", 0));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_git_pass(git_index_read(index, true));
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(git_index_get_bypath(index, ".HEADER", 0));
......@@ -948,7 +948,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_git_pass(git_vector_verify_sorted(&index->entries));
caps = git_index_caps(index);
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps &= ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_assert_equal_i(false, index->ignore_case);
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(e = git_index_get_bypath(index, "src/common.h", 0));
......@@ -956,7 +956,7 @@ void test_index_tests__change_icase_on_instance(void)
cl_assert(e = git_index_get_bypath(index, "COPYING", 0));
cl_assert_equal_p(NULL, e = git_index_get_bypath(index, "copying", 0));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
cl_assert_equal_i(true, index->ignore_case);
cl_git_pass(git_vector_verify_sorted(&index->entries));
cl_assert(e = git_index_get_bypath(index, "COPYING", 0));
......
......@@ -222,10 +222,10 @@ static void check_index_range(
cl_git_pass(git_repository_index(&index, repo));
caps = git_index_caps(index);
is_ignoring_case = ((caps & GIT_INDEXCAP_IGNORE_CASE) != 0);
is_ignoring_case = ((caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
if (ignore_case != is_ignoring_case)
cl_git_pass(git_index_set_caps(index, caps ^ GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps ^ GIT_INDEX_CAPABILITY_IGNORE_CASE));
i_opts.flags = 0;
i_opts.start = start;
......@@ -363,7 +363,7 @@ void test_iterator_index__icase_1(void)
caps = git_index_caps(index);
/* force case sensitivity */
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* autoexpand with no tree entries over range */
i_opts.start = "c";
......@@ -409,7 +409,7 @@ void test_iterator_index__icase_1(void)
git_iterator_free(i);
/* force case insensitivity */
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* autoexpand with no tree entries over range */
i_opts.flags = 0;
......@@ -783,7 +783,7 @@ void test_iterator_index__pathlist_1(void)
cl_git_pass(git_vector_insert(&filelist, "k/a"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -825,7 +825,7 @@ void test_iterator_index__pathlist_2(void)
cl_git_pass(git_vector_insert(&filelist, "kZZZZZZZ"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -867,7 +867,7 @@ void test_iterator_index__pathlist_four(void)
cl_git_pass(git_vector_insert(&filelist, "kZZZZZZZ"));
/* In this test we DO NOT force a case setting on the index. */
default_icase = ((git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0);
default_icase = ((git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
i_opts.pathlist.strings = (char **)filelist.contents;
i_opts.pathlist.count = filelist.length;
......@@ -910,7 +910,7 @@ void test_iterator_index__pathlist_icase(void)
caps = git_index_caps(index);
/* force case sensitivity */
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps & ~GIT_INDEX_CAPABILITY_IGNORE_CASE));
/* All indexfilelist iterator tests are "autoexpand with no tree entries" */
......@@ -930,7 +930,7 @@ void test_iterator_index__pathlist_icase(void)
git_iterator_free(i);
/* force case insensitivity */
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEXCAP_IGNORE_CASE));
cl_git_pass(git_index_set_caps(index, caps | GIT_INDEX_CAPABILITY_IGNORE_CASE));
i_opts.start = "c";
i_opts.end = "k/D";
......@@ -1297,17 +1297,17 @@ static void add_conflict(
ancestor.path = ancestor_path;
ancestor.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&ancestor.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&ancestor, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor, 1);
ours.path = our_path;
ours.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&ours.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&ours, 2);
GIT_INDEX_ENTRY_STAGE_SET(&ours, 2);
theirs.path = their_path;
theirs.mode = GIT_FILEMODE_BLOB;
git_oid_fromstr(&theirs.id, "d44e18fb93b7107b5cd1b95d601591d77869a1b6");
GIT_IDXENTRY_STAGE_SET(&theirs, 3);
GIT_INDEX_ENTRY_STAGE_SET(&theirs, 3);
cl_git_pass(git_index_conflict_add(index, &ancestor, &ours, &theirs));
}
......
......@@ -18,9 +18,9 @@ void test_object_tree_duplicateentries__cleanup(void) {
* parent cf80f8de9f1185bf3a05f993f6121880dd0cfbc9
* author Ben Straub <bstraub@github.com> 1343755506 -0700
* committer Ben Straub <bstraub@github.com> 1343755506 -0700
*
*
* Change a file mode
*
*
* diff --git a/a/b.txt b/a/b.txt
* old mode 100644
* new mode 100755
......@@ -69,7 +69,7 @@ static void two_blobs(git_treebuilder *bld)
{
git_oid oid;
const git_tree_entry *entry;
cl_git_pass(git_oid_fromstr(&oid,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */
......@@ -89,7 +89,7 @@ static void one_blob_and_one_tree(git_treebuilder *bld)
{
git_oid oid;
const git_tree_entry *entry;
cl_git_pass(git_oid_fromstr(&oid,
"a8233120f6ad708f843d861ce2b7228ec4e3dec6")); /* blob oid (README) */
......@@ -111,7 +111,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_through_
tree_creator(&tid, two_blobs);
tree_checker(&tid, "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd", GIT_FILEMODE_BLOB);
tree_creator(&tid, one_blob_and_one_tree);
tree_checker(&tid, "4e0883eeeeebc1fb1735161cea82f7cb5fab7e63", GIT_FILEMODE_TREE);
}
......@@ -126,17 +126,17 @@ static void add_fake_conflicts(git_index *index)
ancestor_entry.path = "duplicate";
ancestor_entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, 1);
GIT_INDEX_ENTRY_STAGE_SET(&ancestor_entry, 1);
git_oid_fromstr(&ancestor_entry.id, "a8233120f6ad708f843d861ce2b7228ec4e3dec6");
our_entry.path = "duplicate";
our_entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&our_entry, 2);
GIT_INDEX_ENTRY_STAGE_SET(&our_entry, 2);
git_oid_fromstr(&our_entry.id, "45b983be36b73c0788dc9cbcb76cbb80fc7bb057");
their_entry.path = "duplicate";
their_entry.mode = GIT_FILEMODE_BLOB;
GIT_IDXENTRY_STAGE_SET(&their_entry, 3);
GIT_INDEX_ENTRY_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));
......@@ -149,7 +149,7 @@ void test_object_tree_duplicateentries__cannot_create_a_duplicate_entry_building
cl_git_pass(git_repository_index(&index, _repo));
add_fake_conflicts(index);
add_fake_conflicts(index);
cl_assert_equal_i(GIT_EUNMERGED, git_index_write_tree(&tid, index));
......
......@@ -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";
GIT_IDXENTRY_STAGE_SET(&entry, side);
GIT_INDEX_ENTRY_STAGE_SET(&entry, side);
entry.mode = 0100644;
git_oid_cpy(&entry.id, oid);
......
......@@ -167,7 +167,7 @@ void test_status_ignore__ignore_pattern_ignorecase(void)
cl_git_mkfile("empty_standard_repo/A.txt", "Differs in case");
cl_git_pass(git_repository_index(&index, g_repo));
ignore_case = (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0;
ignore_case = (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0;
git_index_free(index);
cl_git_pass(git_status_file(&flags, g_repo, "A.txt"));
......
......@@ -483,7 +483,7 @@ void test_status_renames__both_casechange_one(void)
cl_git_pass(git_status_list_new(&statuslist, g_repo, &opts));
check_status(statuslist, (index_caps & GIT_INDEXCAP_IGNORE_CASE) ?
check_status(statuslist, (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) ?
expected_icase : expected_case, 1);
git_status_list_free(statuslist);
......@@ -550,7 +550,7 @@ void test_status_renames__both_casechange_two(void)
cl_git_pass(git_status_list_new(&statuslist, g_repo, &opts));
check_status(statuslist, (index_caps & GIT_INDEXCAP_IGNORE_CASE) ?
check_status(statuslist, (index_caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) ?
expected_icase : expected_case, 4);
git_status_list_free(statuslist);
......
......@@ -154,7 +154,7 @@ void test_status_worktree__swap_subdir_and_file(void)
bool ignore_case;
cl_git_pass(git_repository_index(&index, repo));
ignore_case = (git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0;
ignore_case = (git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0;
git_index_free(index);
/* first alter the contents of the worktree */
......@@ -889,7 +889,7 @@ void test_status_worktree__sorting_by_case(void)
cl_git_pass(git_repository_index(&index, repo));
native_ignore_case =
(git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0;
(git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0;
git_index_free(index);
memset(&counts, 0, sizeof(counts));
......@@ -1222,7 +1222,7 @@ void test_status_worktree__with_directory_in_pathlist(void)
cl_git_pass(git_repository_index(&index, repo));
native_ignore_case =
(git_index_caps(index) & GIT_INDEXCAP_IGNORE_CASE) != 0;
(git_index_caps(index) & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0;
git_index_free(index);
opts.pathspec.strings = &subdir_path;
......
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