summaryrefslogtreecommitdiff
path: root/tests/patch
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2015-09-23 13:40:12 -0400
committerEdward Thomson <ethomson@github.com>2016-05-26 13:01:06 -0500
commit82175084e17d31051e691ebdcb5990a12d0230e7 (patch)
tree07f65363bdf7c3dc0a667cf41f20d3ffca34ecaf /tests/patch
parent19e46645af31b594514cdf88e0ff037e15f39b9b (diff)
downloadlibgit2-82175084e17d31051e691ebdcb5990a12d0230e7.tar.gz
Introduce git_patch_options, handle prefixes
Handle prefixes (in terms of number of path components) for patch parsing.
Diffstat (limited to 'tests/patch')
-rw-r--r--tests/patch/parse.c8
-rw-r--r--tests/patch/print.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/tests/patch/parse.c b/tests/patch/parse.c
index 3191c8c3f..28f61ffcd 100644
--- a/tests/patch/parse.c
+++ b/tests/patch/parse.c
@@ -8,19 +8,21 @@ 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(&patch, PATCH_ORIGINAL_TO_CHANGE_MIDDLE, strlen(PATCH_ORIGINAL_TO_CHANGE_MIDDLE)));
+ cl_git_pass(git_patch_from_patchfile(
+ &patch, PATCH_ORIGINAL_TO_CHANGE_MIDDLE,
+ strlen(PATCH_ORIGINAL_TO_CHANGE_MIDDLE), NULL));
cl_assert((delta = git_patch_get_delta(patch)) != NULL);
cl_assert_equal_i(2, delta->nfiles);
- cl_assert_equal_s(delta->old_file.path, "a/file.txt");
+ cl_assert_equal_s(delta->old_file.path, "file.txt");
cl_assert(delta->old_file.mode == GIT_FILEMODE_BLOB);
cl_assert_equal_i(7, delta->old_file.id_abbrev);
git_oid_nfmt(idstr, delta->old_file.id_abbrev, &delta->old_file.id);
cl_assert_equal_s(idstr, "9432026");
cl_assert_equal_i(0, delta->old_file.size);
- cl_assert_equal_s(delta->new_file.path, "b/file.txt");
+ cl_assert_equal_s(delta->new_file.path, "file.txt");
cl_assert(delta->new_file.mode == GIT_FILEMODE_BLOB);
cl_assert_equal_i(7, delta->new_file.id_abbrev);
git_oid_nfmt(idstr, delta->new_file.id_abbrev, &delta->new_file.id);
diff --git a/tests/patch/print.c b/tests/patch/print.c
index 9bfc5f0eb..a07328fa8 100644
--- a/tests/patch/print.c
+++ b/tests/patch/print.c
@@ -12,7 +12,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));
+ cl_git_pass(git_patch_from_patchfile(&patch, data, len, NULL));
cl_git_pass(git_patch_to_buf(&buf, patch));
cl_assert_equal_s(data, buf.ptr);