]> git.proxmox.com Git - libgit2.git/blobdiff - tests/patch/parse.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / tests / patch / parse.c
index 3f89eb51af965f5238f32a4307cef36ce5243e21..a3c4c6730b4dcea76a2f890e8cf3c6887bc1f1c0 100644 (file)
@@ -27,13 +27,14 @@ static void ensure_patch_validity(git_patch *patch)
        cl_assert_equal_i(0, delta->new_file.size);
 }
 
-static void ensure_identical_patch_inout(const char *content) {
+static void ensure_identical_patch_inout(const char *content)
+{
        git_buf buf = GIT_BUF_INIT;
        git_patch *patch;
 
        cl_git_pass(git_patch_from_buffer(&patch, content, strlen(content), NULL));
        cl_git_pass(git_patch_to_buf(&buf, patch));
-       cl_assert_equal_strn(git_buf_cstr(&buf), content, strlen(content));
+       cl_assert_equal_strn(buf.ptr, content, strlen(content));
 
        git_patch_free(patch);
        git_buf_dispose(&buf);
@@ -131,12 +132,13 @@ void test_patch_parse__files_with_whitespaces_succeeds(void)
 
 void test_patch_parse__lifetime_of_patch_does_not_depend_on_buffer(void)
 {
-       git_buf diff = GIT_BUF_INIT, rendered = GIT_BUF_INIT;
+       git_str diff = GIT_STR_INIT;
+       git_buf rendered = GIT_BUF_INIT;
        git_patch *patch;
 
-       cl_git_pass(git_buf_sets(&diff, PATCH_ORIGINAL_TO_CHANGE_MIDDLE));
+       cl_git_pass(git_str_sets(&diff, PATCH_ORIGINAL_TO_CHANGE_MIDDLE));
        cl_git_pass(git_patch_from_buffer(&patch, diff.ptr, diff.size, NULL));
-       git_buf_dispose(&diff);
+       git_str_dispose(&diff);
 
        cl_git_pass(git_patch_to_buf(&rendered, patch));
        cl_assert_equal_s(PATCH_ORIGINAL_TO_CHANGE_MIDDLE, rendered.ptr);