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
57e765b2
Commit
57e765b2
authored
Mar 09, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1175 from carlosmn/diff-0-ctx
Can't perform diff with no context lines
parents
0887b580
1aa5318a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
include/git2/diff.h
+1
-1
src/diff.c
+4
-1
src/diff_output.c
+1
-1
tests-clar/diff/tree.c
+2
-0
No files found.
include/git2/diff.h
View file @
57e765b2
...
...
@@ -289,7 +289,7 @@ typedef struct {
}
git_diff_options
;
#define GIT_DIFF_OPTIONS_VERSION 1
#define GIT_DIFF_OPTIONS_INIT {GIT_DIFF_OPTIONS_VERSION}
#define GIT_DIFF_OPTIONS_INIT {GIT_DIFF_OPTIONS_VERSION
, GIT_DIFF_NORMAL, 3
}
/**
* When iterating over a diff, callback that will be made per file.
...
...
src/diff.c
View file @
57e765b2
...
...
@@ -291,8 +291,11 @@ static git_diff_list *git_diff_list_alloc(
* - diff.noprefix
*/
if
(
opts
==
NULL
)
if
(
opts
==
NULL
)
{
/* Make sure we default to 3 lines */
diff
->
opts
.
context_lines
=
3
;
return
diff
;
}
memcpy
(
&
diff
->
opts
,
opts
,
sizeof
(
git_diff_options
));
...
...
src/diff_output.c
View file @
57e765b2
...
...
@@ -202,7 +202,7 @@ static void setup_xdiff_options(
memset
(
param
,
0
,
sizeof
(
xpparam_t
));
cfg
->
ctxlen
=
(
!
opts
||
!
opts
->
context_lines
)
?
3
:
opts
->
context_lines
;
(
!
opts
)
?
3
:
opts
->
context_lines
;
cfg
->
interhunkctxlen
=
(
!
opts
)
?
0
:
opts
->
interhunk_lines
;
...
...
tests-clar/diff/tree.c
View file @
57e765b2
...
...
@@ -10,6 +10,8 @@ static diff_expects expect;
void
test_diff_tree__initialize
(
void
)
{
GIT_INIT_STRUCTURE
(
&
opts
,
GIT_DIFF_OPTIONS_VERSION
);
/* The default context lines is set by _INIT which we can't use here */
opts
.
context_lines
=
3
;
memset
(
&
expect
,
0
,
sizeof
(
expect
));
...
...
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