Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Hengeveld <nickh@github.com>2013-11-19 02:03:25 +0400
committerNick Hengeveld <nickh@github.com>2013-11-19 02:03:25 +0400
commitd8e7ffc2a246491aa139875e840fff34c832a739 (patch)
tree26c8ac94f356e381b98274413f4446dc9573aa2e /tests/diff
parente1ce5249e52e9c5271727d7e2ef5bba4c45277b9 (diff)
Add content offset to git_diff_line
For additions and deletions, external consumers like subversion can make use of the content offset to generate diffs in their proprietary formats.
Diffstat (limited to 'tests/diff')
-rw-r--r--tests/diff/patch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/diff/patch.c b/tests/diff/patch.c
index 366e5da58..bd1598b21 100644
--- a/tests/diff/patch.c
+++ b/tests/diff/patch.c
@@ -275,6 +275,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("Ivory their outposts were--the guardrooms of them gilded,\n", actual.ptr);
cl_assert_equal_i(6, line->old_lineno);
cl_assert_equal_i(6, line->new_lineno);
+ cl_assert_equal_i(-1, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 0, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)line->origin);
@@ -282,6 +283,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("All the world went softly when it walked before my Cities--\n", actual.ptr);
cl_assert_equal_i(9, line->old_lineno);
cl_assert_equal_i(-1, line->new_lineno);
+ cl_assert_equal_i(252, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 0, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)line->origin);
@@ -289,6 +291,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("This is some new text;\n", actual.ptr);
cl_assert_equal_i(-1, line->old_lineno);
cl_assert_equal_i(9, line->new_lineno);
+ cl_assert_equal_i(252, line->content_offset);
/* check hunk 1 */
@@ -309,6 +312,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("My rulers and their treasure and their unborn populations,\n", actual.ptr);
cl_assert_equal_i(31, line->old_lineno);
cl_assert_equal_i(25, line->new_lineno);
+ cl_assert_equal_i(-1, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 1, 3));
cl_assert_equal_i(GIT_DIFF_LINE_DELETION, (int)line->origin);
@@ -316,6 +320,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("The Daughters of the Palace whom they cherished in my Cities,\n", actual.ptr);
cl_assert_equal_i(34, line->old_lineno);
cl_assert_equal_i(-1, line->new_lineno);
+ cl_assert_equal_i(1468, line->content_offset);
cl_git_pass(git_patch_get_line_in_hunk(&line, patch, 1, 12));
cl_assert_equal_i(GIT_DIFF_LINE_ADDITION, (int)line->origin);
@@ -323,6 +328,7 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
cl_assert_equal_s("Another replacement;\n", actual.ptr);
cl_assert_equal_i(-1, line->old_lineno);
cl_assert_equal_i(28, line->new_lineno);
+ cl_assert_equal_i(1066, line->content_offset);
git_patch_free(patch);
git_diff_free(diff);