static void create_index(struct checkout_index_entry *entries, size_t entries_len)
{
- git_buf path = GIT_BUF_INIT;
+ git_str path = GIT_STR_INIT;
size_t i;
for (i = 0; i < entries_len; i++) {
- git_buf_joinpath(&path, TEST_REPO_PATH, entries[i].path);
+ git_str_joinpath(&path, TEST_REPO_PATH, entries[i].path);
if (entries[i].stage == 3 && (i == 0 || strcmp(entries[i-1].path, entries[i].path) != 0 || entries[i-1].stage != 2))
- p_unlink(git_buf_cstr(&path));
+ p_unlink(git_str_cstr(&path));
cl_git_pass(git_index_remove_bypath(g_index, entries[i].path));
}
cl_git_pass(git_index_add(g_index, &entry));
}
- git_buf_dispose(&path);
+ git_str_dispose(&path);
}
static void create_index_names(struct checkout_name_entry *entries, size_t entries_len)
static void ensure_workdir_contents(const char *path, const char *contents)
{
- git_buf fullpath = GIT_BUF_INIT, data_buf = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT, data_buf = GIT_STR_INIT;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(git_futils_readbuffer(&data_buf, git_buf_cstr(&fullpath)));
- cl_assert(strcmp(git_buf_cstr(&data_buf), contents) == 0);
+ cl_git_pass(git_futils_readbuffer(&data_buf, git_str_cstr(&fullpath)));
+ cl_assert(strcmp(git_str_cstr(&data_buf), contents) == 0);
- git_buf_dispose(&fullpath);
- git_buf_dispose(&data_buf);
+ git_str_dispose(&fullpath);
+ git_str_dispose(&data_buf);
}
static void ensure_workdir_oid(const char *path, const char *oid_str)
GIT_UNUSED(path);
GIT_UNUSED(mode);
#else
- git_buf fullpath = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT;
struct stat st;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(p_stat(git_buf_cstr(&fullpath), &st));
+ cl_git_pass(p_stat(git_str_cstr(&fullpath), &st));
cl_assert_equal_i((mode & S_IRWXU), (st.st_mode & S_IRWXU));
- git_buf_dispose(&fullpath);
+ git_str_dispose(&fullpath);
#endif
}
if (!symlinks) {
ensure_workdir_contents(path, target);
} else {
- git_buf fullpath = GIT_BUF_INIT;
+ git_str fullpath = GIT_STR_INIT;
char actual[1024];
struct stat st;
int len;
cl_git_pass(
- git_buf_joinpath(&fullpath, git_repository_workdir(g_repo), path));
+ git_str_joinpath(&fullpath, git_repository_workdir(g_repo), path));
- cl_git_pass(p_lstat(git_buf_cstr(&fullpath), &st));
+ cl_git_pass(p_lstat(git_str_cstr(&fullpath), &st));
cl_assert(S_ISLNK(st.st_mode));
- cl_assert((len = p_readlink(git_buf_cstr(&fullpath), actual, 1024)) > 0);
+ cl_assert((len = p_readlink(git_str_cstr(&fullpath), actual, 1024)) > 0);
actual[len] = '\0';
cl_assert(strcmp(actual, target) == 0);
- git_buf_dispose(&fullpath);
+ git_str_dispose(&fullpath);
}
}
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
- cl_assert(!git_path_exists(TEST_REPO_PATH "/conflicting.txt"));
+ cl_assert(!git_fs_path_exists(TEST_REPO_PATH "/conflicting.txt"));
}
void test_checkout_conflict__ours(void)
ensure_workdir_contents("automergeable.txt", AUTOMERGEABLE_MERGED_FILE);
ensure_workdir("directory_file-two/file", 0100644, CONFLICTING_OURS_OID);
- cl_assert(!git_path_exists("merge-resolve/modify-delete"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one-side-one.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one-side-two.txt"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt~ours"));
- cl_assert(!git_path_exists("merge-resolve/test-one.txt~theirs"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-one/file"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-one~ours"));
- cl_assert(!git_path_exists("merge-resolve/directory_file-two~theirs"));
+ cl_assert(!git_fs_path_exists("merge-resolve/modify-delete"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one-side-one.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one-side-two.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt~ours"));
+ cl_assert(!git_fs_path_exists("merge-resolve/test-one.txt~theirs"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-one/file"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-one~ours"));
+ cl_assert(!git_fs_path_exists("merge-resolve/directory_file-two~theirs"));
}
void test_checkout_conflict__path_filters(void)
cl_git_pass(git_checkout_index(g_repo, g_index, &opts));
ensure_workdir_contents("conflicting-1.txt", CONFLICTING_DIFF3_FILE);
- cl_assert(!git_path_exists("merge-resolve/conflicting-2.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/conflicting-2.txt"));
ensure_workdir_contents("conflicting-3.txt", AUTOMERGEABLE_MERGED_FILE);
- cl_assert(!git_path_exists("merge-resolve/conflicting-4.txt"));
+ cl_assert(!git_fs_path_exists("merge-resolve/conflicting-4.txt"));
}
static void collect_progress(