diff options
Diffstat (limited to 'tests/repo/open.c')
-rw-r--r-- | tests/repo/open.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/tests/repo/open.c b/tests/repo/open.c index bd60c12c2..6558805c8 100644 --- a/tests/repo/open.c +++ b/tests/repo/open.c @@ -105,12 +105,12 @@ void test_repo_open__check_if_repository(void) static void make_gitlink_dir(const char *dir, const char *linktext) { - git_buf path = GIT_BUF_INIT; + git_str path = GIT_STR_INIT; cl_git_pass(git_futils_mkdir(dir, 0777, GIT_MKDIR_VERIFY_DIR)); - cl_git_pass(git_buf_joinpath(&path, dir, ".git")); + cl_git_pass(git_str_joinpath(&path, dir, ".git")); cl_git_rewritefile(path.ptr, linktext); - git_buf_dispose(&path); + git_str_dispose(&path); } void test_repo_open__gitlinked(void) @@ -136,7 +136,7 @@ void test_repo_open__gitlinked(void) void test_repo_open__with_symlinked_config(void) { #ifndef GIT_WIN32 - git_buf path = GIT_BUF_INIT; + git_str path = GIT_STR_INIT; git_repository *repo; git_config *cfg; int32_t value; @@ -157,9 +157,9 @@ void test_repo_open__with_symlinked_config(void) git_config_free(cfg); git_repository_free(repo); - cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), NULL, GIT_RMDIR_REMOVE_FILES)); + cl_git_pass(git_futils_rmdir_r(git_str_cstr(&path), NULL, GIT_RMDIR_REMOVE_FILES)); cl_sandbox_set_search_path_defaults(); - git_buf_dispose(&path); + git_str_dispose(&path); #endif } @@ -173,7 +173,7 @@ void test_repo_open__from_git_new_workdir(void) */ git_repository *repo2; - git_buf link_tgt = GIT_BUF_INIT, link = GIT_BUF_INIT, body = GIT_BUF_INIT; + git_str link_tgt = GIT_STR_INIT, link = GIT_STR_INIT, body = GIT_STR_INIT; const char **scan; int link_fd; static const char *links[] = { @@ -190,19 +190,19 @@ void test_repo_open__from_git_new_workdir(void) cl_git_pass(p_mkdir("alternate/.git", 0777)); for (scan = links; *scan != NULL; scan++) { - git_buf_joinpath(&link_tgt, "empty_standard_repo/.git", *scan); + git_str_joinpath(&link_tgt, "empty_standard_repo/.git", *scan); if (git_path_exists(link_tgt.ptr)) { - git_buf_joinpath(&link_tgt, "../../empty_standard_repo/.git", *scan); - git_buf_joinpath(&link, "alternate/.git", *scan); + git_str_joinpath(&link_tgt, "../../empty_standard_repo/.git", *scan); + git_str_joinpath(&link, "alternate/.git", *scan); if (strchr(*scan, '/')) git_futils_mkpath2file(link.ptr, 0777); cl_assert_(symlink(link_tgt.ptr, link.ptr) == 0, strerror(errno)); } } for (scan = copies; *scan != NULL; scan++) { - git_buf_joinpath(&link_tgt, "empty_standard_repo/.git", *scan); + git_str_joinpath(&link_tgt, "empty_standard_repo/.git", *scan); if (git_path_exists(link_tgt.ptr)) { - git_buf_joinpath(&link, "alternate/.git", *scan); + git_str_joinpath(&link, "alternate/.git", *scan); cl_git_pass(git_futils_readbuffer(&body, link_tgt.ptr)); cl_assert((link_fd = git_futils_creat_withpath(link.ptr, 0777, 0666)) >= 0); @@ -211,9 +211,9 @@ void test_repo_open__from_git_new_workdir(void) } } - git_buf_dispose(&link_tgt); - git_buf_dispose(&link); - git_buf_dispose(&body); + git_str_dispose(&link_tgt); + git_str_dispose(&link); + git_str_dispose(&body); cl_git_pass(git_repository_open(&repo2, "alternate")); @@ -233,10 +233,10 @@ void test_repo_open__from_git_new_workdir(void) void test_repo_open__failures(void) { git_repository *base, *repo; - git_buf ceiling = GIT_BUF_INIT; + git_str ceiling = GIT_STR_INIT; base = cl_git_sandbox_init("attr"); - cl_git_pass(git_buf_sets(&ceiling, git_repository_workdir(base))); + cl_git_pass(git_str_sets(&ceiling, git_repository_workdir(base))); /* fail with no searching */ cl_git_fail(git_repository_open(&repo, "attr/sub")); @@ -245,7 +245,7 @@ void test_repo_open__failures(void) /* fail with ceiling too low */ cl_git_fail(git_repository_open_ext(&repo, "attr/sub", 0, ceiling.ptr)); - cl_git_pass(git_buf_joinpath(&ceiling, ceiling.ptr, "sub")); + cl_git_pass(git_str_joinpath(&ceiling, ceiling.ptr, "sub")); cl_git_fail(git_repository_open_ext(&repo, "attr/sub/sub", 0, ceiling.ptr)); /* fail with no repo */ @@ -260,7 +260,7 @@ void test_repo_open__failures(void) GIT_REPOSITORY_OPEN_NO_SEARCH | GIT_REPOSITORY_OPEN_NO_DOTGIT, NULL)); - git_buf_dispose(&ceiling); + git_str_dispose(&ceiling); } void test_repo_open__bad_gitlinks(void) @@ -291,7 +291,7 @@ void test_repo_open__bad_gitlinks(void) } #ifdef GIT_WIN32 -static void unposix_path(git_buf *path) +static void unposix_path(git_str *path) { char *src, *tgt; @@ -318,44 +318,44 @@ void test_repo_open__win32_path(void) { #ifdef GIT_WIN32 git_repository *repo = cl_git_sandbox_init("empty_standard_repo"), *repo2; - git_buf winpath = GIT_BUF_INIT; + git_str winpath = GIT_STR_INIT; static const char *repo_path = "empty_standard_repo/.git/"; static const char *repo_wd = "empty_standard_repo/"; cl_assert(git__suffixcmp(git_repository_path(repo), repo_path) == 0); cl_assert(git__suffixcmp(git_repository_workdir(repo), repo_wd) == 0); - cl_git_pass(git_buf_sets(&winpath, git_repository_path(repo))); + cl_git_pass(git_str_sets(&winpath, git_repository_path(repo))); unposix_path(&winpath); cl_git_pass(git_repository_open(&repo2, winpath.ptr)); cl_assert(git__suffixcmp(git_repository_path(repo2), repo_path) == 0); cl_assert(git__suffixcmp(git_repository_workdir(repo2), repo_wd) == 0); git_repository_free(repo2); - cl_git_pass(git_buf_sets(&winpath, git_repository_path(repo))); - git_buf_truncate(&winpath, winpath.size - 1); /* remove trailing '/' */ + cl_git_pass(git_str_sets(&winpath, git_repository_path(repo))); + git_str_truncate(&winpath, winpath.size - 1); /* remove trailing '/' */ unposix_path(&winpath); cl_git_pass(git_repository_open(&repo2, winpath.ptr)); cl_assert(git__suffixcmp(git_repository_path(repo2), repo_path) == 0); cl_assert(git__suffixcmp(git_repository_workdir(repo2), repo_wd) == 0); git_repository_free(repo2); - cl_git_pass(git_buf_sets(&winpath, git_repository_workdir(repo))); + cl_git_pass(git_str_sets(&winpath, git_repository_workdir(repo))); unposix_path(&winpath); cl_git_pass(git_repository_open(&repo2, winpath.ptr)); cl_assert(git__suffixcmp(git_repository_path(repo2), repo_path) == 0); cl_assert(git__suffixcmp(git_repository_workdir(repo2), repo_wd) == 0); git_repository_free(repo2); - cl_git_pass(git_buf_sets(&winpath, git_repository_workdir(repo))); - git_buf_truncate(&winpath, winpath.size - 1); /* remove trailing '/' */ + cl_git_pass(git_str_sets(&winpath, git_repository_workdir(repo))); + git_str_truncate(&winpath, winpath.size - 1); /* remove trailing '/' */ unposix_path(&winpath); cl_git_pass(git_repository_open(&repo2, winpath.ptr)); cl_assert(git__suffixcmp(git_repository_path(repo2), repo_path) == 0); cl_assert(git__suffixcmp(git_repository_workdir(repo2), repo_wd) == 0); git_repository_free(repo2); - git_buf_dispose(&winpath); + git_str_dispose(&winpath); #endif } @@ -367,7 +367,7 @@ void test_repo_open__opening_a_non_existing_repository_returns_ENOTFOUND(void) void test_repo_open__no_config(void) { - git_buf path = GIT_BUF_INIT; + git_str path = GIT_STR_INIT; git_repository *repo; git_config *config; @@ -389,7 +389,7 @@ void test_repo_open__no_config(void) cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr)); - git_buf_dispose(&path); + git_str_dispose(&path); cl_git_pass(git_repository_open(&repo, "empty_standard_repo")); cl_git_pass(git_repository_config(&config, repo)); |