summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2015-11-21 12:27:03 -0500
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:08 -0500
commit440e3bae10a4758d5de8d7b8699bf4c412c1a163 (patch)
tree281ea92c4e39070bab916650ef06129ce876afc0 /tests
parent00e63b36202be18b1dd1690049f8cbb755132f1b (diff)
downloadlibgit2-440e3bae10a4758d5de8d7b8699bf4c412c1a163.tar.gz
patch: `git_patch_from_patchfile` -> `git_patch_from_buffer`
Diffstat (limited to 'tests')
-rw-r--r--tests/apply/fromfile.c25
-rw-r--r--tests/patch/parse.c3
-rw-r--r--tests/patch/print.c3
3 files changed, 17 insertions, 14 deletions
diff --git a/tests/apply/fromfile.c b/tests/apply/fromfile.c
index ec2b889b3..7eb1af90c 100644
--- a/tests/apply/fromfile.c
+++ b/tests/apply/fromfile.c
@@ -2,6 +2,7 @@
#include "git2/sys/repository.h"
#include "apply.h"
+#include "patch.h"
#include "repository.h"
#include "buf_text.h"
@@ -35,7 +36,7 @@ static int apply_patchfile(
unsigned int mode;
int error;
- cl_git_pass(git_patch_from_patchfile(&patch, patchfile, strlen(patchfile), NULL));
+ cl_git_pass(git_patch_from_buffer(&patch, patchfile, strlen(patchfile), NULL));
error = git_apply__patch(&result, &filename, &mode, old, old_len, patch);
@@ -308,28 +309,28 @@ void test_apply_fromfile__noisy_nocontext(void)
void test_apply_fromfile__fail_truncated_1(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, PATCH_TRUNCATED_1,
+ cl_git_fail(git_patch_from_buffer(&patch, PATCH_TRUNCATED_1,
strlen(PATCH_TRUNCATED_1), NULL));
}
void test_apply_fromfile__fail_truncated_2(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, PATCH_TRUNCATED_2,
+ cl_git_fail(git_patch_from_buffer(&patch, PATCH_TRUNCATED_2,
strlen(PATCH_TRUNCATED_2), NULL));
}
void test_apply_fromfile__fail_truncated_3(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, PATCH_TRUNCATED_3,
+ cl_git_fail(git_patch_from_buffer(&patch, PATCH_TRUNCATED_3,
strlen(PATCH_TRUNCATED_3), NULL));
}
void test_apply_fromfile__fail_corrupt_githeader(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, PATCH_CORRUPT_GIT_HEADER,
+ cl_git_fail(git_patch_from_buffer(&patch, PATCH_CORRUPT_GIT_HEADER,
strlen(PATCH_CORRUPT_GIT_HEADER), NULL));
}
@@ -353,7 +354,7 @@ void test_apply_fromfile__append_no_nl(void)
void test_apply_fromfile__fail_missing_new_file(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch,
+ cl_git_fail(git_patch_from_buffer(&patch,
PATCH_CORRUPT_MISSING_NEW_FILE,
strlen(PATCH_CORRUPT_MISSING_NEW_FILE), NULL));
}
@@ -361,7 +362,7 @@ void test_apply_fromfile__fail_missing_new_file(void)
void test_apply_fromfile__fail_missing_old_file(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch,
+ cl_git_fail(git_patch_from_buffer(&patch,
PATCH_CORRUPT_MISSING_OLD_FILE,
strlen(PATCH_CORRUPT_MISSING_OLD_FILE), NULL));
}
@@ -369,7 +370,7 @@ void test_apply_fromfile__fail_missing_old_file(void)
void test_apply_fromfile__fail_no_changes(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch,
+ cl_git_fail(git_patch_from_buffer(&patch,
PATCH_CORRUPT_NO_CHANGES,
strlen(PATCH_CORRUPT_NO_CHANGES), NULL));
}
@@ -377,7 +378,7 @@ void test_apply_fromfile__fail_no_changes(void)
void test_apply_fromfile__fail_missing_hunk_header(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch,
+ cl_git_fail(git_patch_from_buffer(&patch,
PATCH_CORRUPT_MISSING_HUNK_HEADER,
strlen(PATCH_CORRUPT_MISSING_HUNK_HEADER), NULL));
}
@@ -385,7 +386,7 @@ void test_apply_fromfile__fail_missing_hunk_header(void)
void test_apply_fromfile__fail_not_a_patch(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, PATCH_NOT_A_PATCH,
+ cl_git_fail(git_patch_from_buffer(&patch, PATCH_NOT_A_PATCH,
strlen(PATCH_NOT_A_PATCH), NULL));
}
@@ -442,6 +443,6 @@ void test_apply_fromfile__empty_file_not_allowed(void)
{
git_patch *patch;
- cl_git_fail(git_patch_from_patchfile(&patch, "", 0, NULL));
- cl_git_fail(git_patch_from_patchfile(&patch, NULL, 0, NULL));
+ cl_git_fail(git_patch_from_buffer(&patch, "", 0, NULL));
+ cl_git_fail(git_patch_from_buffer(&patch, NULL, 0, NULL));
}
diff --git a/tests/patch/parse.c b/tests/patch/parse.c
index 28f61ffcd..88cdbf6d7 100644
--- a/tests/patch/parse.c
+++ b/tests/patch/parse.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+#include "patch.h"
#include "patch_common.h"
@@ -8,7 +9,7 @@ void test_patch_parse__original_to_change_middle(void)
const git_diff_delta *delta;
char idstr[GIT_OID_HEXSZ+1] = {0};
- cl_git_pass(git_patch_from_patchfile(
+ cl_git_pass(git_patch_from_buffer(
&patch, PATCH_ORIGINAL_TO_CHANGE_MIDDLE,
strlen(PATCH_ORIGINAL_TO_CHANGE_MIDDLE), NULL));
diff --git a/tests/patch/print.c b/tests/patch/print.c
index a07328fa8..047b48e8f 100644
--- a/tests/patch/print.c
+++ b/tests/patch/print.c
@@ -1,4 +1,5 @@
#include "clar_libgit2.h"
+#include "patch.h"
#include "patch_common.h"
@@ -12,7 +13,7 @@ void patch_print_from_patchfile(const char *data, size_t len)
git_patch *patch;
git_buf buf = GIT_BUF_INIT;
- cl_git_pass(git_patch_from_patchfile(&patch, data, len, NULL));
+ cl_git_pass(git_patch_from_buffer(&patch, data, len, NULL));
cl_git_pass(git_patch_to_buf(&buf, patch));
cl_assert_equal_s(data, buf.ptr);