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
71966e2f
Commit
71966e2f
authored
Oct 08, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend diff helpers for tests a little
parent
dfbff793
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
11 deletions
+40
-11
tests-clar/diff/diff_helpers.c
+27
-2
tests-clar/diff/diff_helpers.h
+4
-0
tests-clar/diff/tree.c
+9
-9
No files found.
tests-clar/diff/diff_helpers.c
View file @
71966e2f
...
...
@@ -30,10 +30,13 @@ int diff_file_fn(
GIT_UNUSED
(
progress
);
if
(
delta
->
binary
)
e
->
files
++
;
if
(
delta
->
binary
)
{
e
->
at_least_one_of_them_is_binary
=
true
;
e
->
files_binary
++
;
}
e
->
files
++
;
switch
(
delta
->
status
)
{
case
GIT_DELTA_ADDED
:
e
->
file_adds
++
;
break
;
case
GIT_DELTA_DELETED
:
e
->
file_dels
++
;
break
;
...
...
@@ -180,3 +183,25 @@ abort:
giterr_clear
();
return
GIT_EUSER
;
}
static
int
diff_print_cb
(
void
*
cb_data
,
const
git_diff_delta
*
delta
,
const
git_diff_range
*
range
,
char
line_origin
,
/**< GIT_DIFF_LINE_... value from above */
const
char
*
content
,
size_t
content_len
)
{
GIT_UNUSED
(
cb_data
);
GIT_UNUSED
(
delta
);
GIT_UNUSED
(
range
);
GIT_UNUSED
(
line_origin
);
GIT_UNUSED
(
content_len
);
fputs
(
content
,
(
FILE
*
)
cb_data
);
return
0
;
}
void
diff_print
(
FILE
*
fp
,
git_diff_list
*
diff
)
{
cl_git_pass
(
git_diff_print_patch
(
diff
,
fp
?
fp
:
stderr
,
diff_print_cb
));
}
tests-clar/diff/diff_helpers.h
View file @
71966e2f
...
...
@@ -6,6 +6,8 @@ extern git_tree *resolve_commit_oid_to_tree(
typedef
struct
{
int
files
;
int
files_binary
;
int
file_adds
;
int
file_dels
;
int
file_mods
;
...
...
@@ -51,3 +53,5 @@ extern int diff_foreach_via_iterator(
git_diff_file_fn
file_cb
,
git_diff_hunk_fn
hunk_cb
,
git_diff_data_fn
line_cb
);
extern
void
diff_print
(
FILE
*
fp
,
git_diff_list
*
diff
);
tests-clar/diff/tree.c
View file @
71966e2f
...
...
@@ -113,16 +113,16 @@ void test_diff_tree__options(void)
*/
diff_expects
test_expects
[]
=
{
/* a vs b tests */
{
5
,
3
,
0
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
51
,
2
,
46
,
3
},
{
5
,
3
,
0
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
53
,
4
,
46
,
3
},
{
5
,
0
,
3
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
52
,
3
,
3
,
46
},
{
5
,
3
,
0
,
2
,
0
,
0
,
0
,
5
,
0
,
0
,
54
,
3
,
47
,
4
},
{
5
,
0
,
3
,
0
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
51
,
2
,
46
,
3
},
{
5
,
0
,
3
,
0
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
53
,
4
,
46
,
3
},
{
5
,
0
,
0
,
3
,
2
,
0
,
0
,
0
,
4
,
0
,
0
,
52
,
3
,
3
,
46
},
{
5
,
0
,
3
,
0
,
2
,
0
,
0
,
0
,
5
,
0
,
0
,
54
,
3
,
47
,
4
},
/* c vs d tests */
{
1
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
22
,
9
,
10
,
3
},
{
1
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
19
,
12
,
7
,
0
},
{
1
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
20
,
11
,
8
,
1
},
{
1
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
20
,
11
,
8
,
1
},
{
1
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
18
,
11
,
0
,
7
},
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
22
,
9
,
10
,
3
},
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
19
,
12
,
7
,
0
},
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
20
,
11
,
8
,
1
},
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
20
,
11
,
8
,
1
},
{
1
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
1
,
0
,
0
,
18
,
11
,
0
,
7
},
{
0
},
};
diff_expects
*
expected
;
...
...
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