]> git.proxmox.com Git - libgit2.git/blobdiff - tests/submodule/open.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / tests / submodule / open.c
index a8a5dccc34e99d54eae85944e042ea57f77e98e9..e6883d208816892c57cc7db74c274f169a214c7a 100644 (file)
@@ -23,33 +23,33 @@ void test_submodule_open__cleanup(void)
 
 static void assert_sm_valid(git_repository *parent, git_repository *child, const char *sm_name)
 {
-       git_buf expected = GIT_BUF_INIT, actual = GIT_BUF_INIT;
+       git_str expected = GIT_STR_INIT, actual = GIT_STR_INIT;
 
        /* assert working directory */
-       cl_git_pass(git_buf_joinpath(&expected, git_repository_workdir(parent), sm_name));
-       cl_git_pass(git_path_prettify_dir(&expected, expected.ptr, NULL));
-       cl_git_pass(git_buf_sets(&actual, git_repository_workdir(child)));
-       cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+       cl_git_pass(git_str_joinpath(&expected, git_repository_workdir(parent), sm_name));
+       cl_git_pass(git_fs_path_prettify_dir(&expected, expected.ptr, NULL));
+       cl_git_pass(git_str_sets(&actual, git_repository_workdir(child)));
+       cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
        cl_assert_equal_s(expected.ptr, actual.ptr);
 
-       git_buf_clear(&expected);
-       git_buf_clear(&actual);
+       git_str_clear(&expected);
+       git_str_clear(&actual);
 
        /* assert common directory */
-       cl_git_pass(git_buf_joinpath(&expected, git_repository_commondir(parent), "modules"));
-       cl_git_pass(git_buf_joinpath(&expected, expected.ptr, sm_name));
-       cl_git_pass(git_path_prettify_dir(&expected, expected.ptr, NULL));
-       cl_git_pass(git_buf_sets(&actual, git_repository_commondir(child)));
-       cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+       cl_git_pass(git_str_joinpath(&expected, git_repository_commondir(parent), "modules"));
+       cl_git_pass(git_str_joinpath(&expected, expected.ptr, sm_name));
+       cl_git_pass(git_fs_path_prettify_dir(&expected, expected.ptr, NULL));
+       cl_git_pass(git_str_sets(&actual, git_repository_commondir(child)));
+       cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
        cl_assert_equal_s(expected.ptr, actual.ptr);
 
        /* assert git directory */
-       cl_git_pass(git_buf_sets(&actual, git_repository_path(child)));
-       cl_git_pass(git_path_prettify_dir(&actual, actual.ptr, NULL));
+       cl_git_pass(git_str_sets(&actual, git_repository_path(child)));
+       cl_git_pass(git_fs_path_prettify_dir(&actual, actual.ptr, NULL));
        cl_assert_equal_s(expected.ptr, actual.ptr);
 
-       git_buf_dispose(&expected);
-       git_buf_dispose(&actual);
+       git_str_dispose(&expected);
+       git_str_dispose(&actual);
 }
 
 void test_submodule_open__opening_via_lookup_succeeds(void)
@@ -61,18 +61,18 @@ void test_submodule_open__opening_via_lookup_succeeds(void)
 
 void test_submodule_open__direct_open_succeeds(void)
 {
-       git_buf path = GIT_BUF_INIT;
+       git_str path = GIT_STR_INIT;
 
-       cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_parent), "sm_unchanged"));
+       cl_git_pass(git_str_joinpath(&path, git_repository_workdir(g_parent), "sm_unchanged"));
        cl_git_pass(git_repository_open(&g_child, path.ptr));
        assert_sm_valid(g_parent, g_child, "sm_unchanged");
 
-       git_buf_dispose(&path);
+       git_str_dispose(&path);
 }
 
 void test_submodule_open__direct_open_succeeds_for_broken_sm_with_gitdir(void)
 {
-       git_buf path = GIT_BUF_INIT;
+       git_str path = GIT_STR_INIT;
 
        /*
         * This is actually not a valid submodule, but we
@@ -82,9 +82,9 @@ void test_submodule_open__direct_open_succeeds_for_broken_sm_with_gitdir(void)
         * add a test for this.
         */
        cl_git_mkfile("submod2/.git/modules/sm_unchanged/gitdir", ".git");
-       cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_parent), "sm_unchanged"));
+       cl_git_pass(git_str_joinpath(&path, git_repository_workdir(g_parent), "sm_unchanged"));
        cl_git_pass(git_repository_open(&g_child, path.ptr));
        assert_sm_valid(g_parent, g_child, "sm_unchanged");
 
-       git_buf_dispose(&path);
+       git_str_dispose(&path);
 }