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
01ae1909
Commit
01ae1909
authored
Sep 06, 2012
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diff: Cleanup documentation and printf compat
parent
2e4a9ea9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
5 deletions
+16
-5
include/git2/diff.h
+12
-1
src/diff_output.c
+4
-4
No files found.
include/git2/diff.h
View file @
01ae1909
...
...
@@ -455,6 +455,11 @@ GIT_EXTERN(int) git_diff_iterator_next_file(
* so the first call for a new file is expensive (at least in relative
* terms - in reality, it is still pretty darn fast).
*
* @param range Pointer where to store the range for the hunk
* @param header Pointer where to store the header for the chunk;
* this string is owned by the library and should not be freed by
* the user
* @param header_len Pointer where to store the length of the returned header
* @param iterator The iterator object
* @return 0 on success, GIT_ITEROVER when done with current file, other
* value < 0 on error
...
...
@@ -468,8 +473,14 @@ GIT_EXTERN(int) git_diff_iterator_next_hunk(
/**
* Return the next line of the current hunk of diffs.
*
* @param line_origin Pointer where to store a GIT_DIFF_LINE_ value;
* this value is a single character, not a buffer
* @param content Pointer where to store the content of the line;
* this string is owned by the library and should not be freed by
* the user
* @param Pointer where to store the length of the returned content
* @param iterator The iterator object
* @return 0 on success, GIT_ITEROVER when done with current
hunk
, other
* @return 0 on success, GIT_ITEROVER when done with current
line
, other
* value < 0 on error
*/
GIT_EXTERN
(
int
)
git_diff_iterator_next_line
(
...
...
src/diff_output.c
View file @
01ae1909
...
...
@@ -89,21 +89,21 @@ static int format_hunk_header(char *header, size_t len, git_diff_range *range)
{
if
(
range
->
old_lines
!=
1
)
{
if
(
range
->
new_lines
!=
1
)
return
snprintf
(
return
p_
snprintf
(
header
,
len
,
"@@ -%d,%d +%d,%d @@"
,
range
->
old_start
,
range
->
old_lines
,
range
->
new_start
,
range
->
new_lines
);
else
return
snprintf
(
return
p_
snprintf
(
header
,
len
,
"@@ -%d,%d +%d @@"
,
range
->
old_start
,
range
->
old_lines
,
range
->
new_start
);
}
else
{
if
(
range
->
new_lines
!=
1
)
return
snprintf
(
return
p_
snprintf
(
header
,
len
,
"@@ -%d +%d,%d @@"
,
range
->
old_start
,
range
->
new_start
,
range
->
new_lines
);
else
return
snprintf
(
return
p_
snprintf
(
header
,
len
,
"@@ -%d +%d @@"
,
range
->
old_start
,
range
->
new_start
);
}
...
...
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