Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
47f70846
Commit
47f70846
authored
Mar 01, 2013
by
Philip Kelley
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1379 from arrbee/fix-tests-with-autocrlf-input-on-windows
Control for core.autocrlf during testing
parents
426b2e2f
7d46b34b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
tests-clar/diff/patch.c
+13
-2
No files found.
tests-clar/diff/patch.c
View file @
47f70846
...
@@ -135,7 +135,9 @@ void test_diff_patch__to_string(void)
...
@@ -135,7 +135,9 @@ void test_diff_patch__to_string(void)
void
test_diff_patch__hunks_have_correct_line_numbers
(
void
)
void
test_diff_patch__hunks_have_correct_line_numbers
(
void
)
{
{
git_config
*
cfg
;
git_tree
*
head
;
git_tree
*
head
;
git_diff_options
opt
=
GIT_DIFF_OPTIONS_INIT
;
git_diff_list
*
diff
;
git_diff_list
*
diff
;
git_diff_patch
*
patch
;
git_diff_patch
*
patch
;
const
git_diff_delta
*
delta
;
const
git_diff_delta
*
delta
;
...
@@ -148,11 +150,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
...
@@ -148,11 +150,15 @@ void test_diff_patch__hunks_have_correct_line_numbers(void)
g_repo
=
cl_git_sandbox_init
(
"renames"
);
g_repo
=
cl_git_sandbox_init
(
"renames"
);
cl_git_pass
(
git_repository_config
(
&
cfg
,
g_repo
));
cl_git_pass
(
git_config_set_bool
(
cfg
,
"core.autocrlf"
,
false
));
git_config_free
(
cfg
);
cl_git_rewritefile
(
"renames/songof7cities.txt"
,
new_content
);
cl_git_rewritefile
(
"renames/songof7cities.txt"
,
new_content
);
cl_git_pass
(
git_repository_head_tree
(
&
head
,
g_repo
));
cl_git_pass
(
git_repository_head_tree
(
&
head
,
g_repo
));
cl_git_pass
(
git_diff_tree_to_workdir
(
&
diff
,
g_repo
,
head
,
NULL
));
cl_git_pass
(
git_diff_tree_to_workdir
(
&
diff
,
g_repo
,
head
,
&
opt
));
cl_assert_equal_i
(
1
,
(
int
)
git_diff_num_deltas
(
diff
));
cl_assert_equal_i
(
1
,
(
int
)
git_diff_num_deltas
(
diff
));
...
@@ -251,7 +257,7 @@ static void check_single_patch_stats(
...
@@ -251,7 +257,7 @@ static void check_single_patch_stats(
cl_git_pass
(
git_diff_get_patch
(
&
patch
,
&
delta
,
diff
,
0
));
cl_git_pass
(
git_diff_get_patch
(
&
patch
,
&
delta
,
diff
,
0
));
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
(
int
)
delta
->
status
);
cl_assert_equal_i
(
GIT_DELTA_MODIFIED
,
(
int
)
delta
->
status
);
cl_assert_equal_
sz
(
hunks
,
git_diff_patch_num_hunks
(
patch
));
cl_assert_equal_
i
((
int
)
hunks
,
(
int
)
git_diff_patch_num_hunks
(
patch
));
cl_git_pass
(
cl_git_pass
(
git_diff_patch_line_stats
(
NULL
,
&
actual_adds
,
&
actual_dels
,
patch
));
git_diff_patch_line_stats
(
NULL
,
&
actual_adds
,
&
actual_dels
,
patch
));
...
@@ -265,12 +271,17 @@ static void check_single_patch_stats(
...
@@ -265,12 +271,17 @@ static void check_single_patch_stats(
void
test_diff_patch__line_counts_with_eofnl
(
void
)
void
test_diff_patch__line_counts_with_eofnl
(
void
)
{
{
git_config
*
cfg
;
git_buf
content
=
GIT_BUF_INIT
;
git_buf
content
=
GIT_BUF_INIT
;
const
char
*
end
;
const
char
*
end
;
git_index
*
index
;
git_index
*
index
;
g_repo
=
cl_git_sandbox_init
(
"renames"
);
g_repo
=
cl_git_sandbox_init
(
"renames"
);
cl_git_pass
(
git_repository_config
(
&
cfg
,
g_repo
));
cl_git_pass
(
git_config_set_bool
(
cfg
,
"core.autocrlf"
,
false
));
git_config_free
(
cfg
);
cl_git_pass
(
git_futils_readbuffer
(
&
content
,
"renames/songof7cities.txt"
));
cl_git_pass
(
git_futils_readbuffer
(
&
content
,
"renames/songof7cities.txt"
));
/* remove first line */
/* remove first line */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment