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
5ef43d41
Commit
5ef43d41
authored
Jun 23, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git_diff__merge: allow pluggable diff merges
parent
83ba5e36
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
src/diff.h
+10
-0
src/diff_tform.c
+9
-3
No files found.
src/diff.h
View file @
5ef43d41
...
...
@@ -123,6 +123,16 @@ extern int git_diff_find_similar__calc_similarity(
extern
int
git_diff__commit
(
git_diff
**
diff
,
git_repository
*
repo
,
const
git_commit
*
commit
,
const
git_diff_options
*
opts
);
/* Merge two `git_diff`s according to the callback given by `cb`. */
typedef
git_diff_delta
*
(
*
git_diff__merge_cb
)(
const
git_diff_delta
*
left
,
const
git_diff_delta
*
right
,
git_pool
*
pool
);
extern
int
git_diff__merge
(
git_diff
*
onto
,
const
git_diff
*
from
,
git_diff__merge_cb
cb
);
/*
* Sometimes a git_diff_file will have a zero size; this attempts to
* fill in the size without loading the blob if possible. If that is
...
...
src/diff_tform.c
View file @
5ef43d41
...
...
@@ -109,7 +109,8 @@ static git_diff_delta *diff_delta__merge_like_cgit(
return
dup
;
}
int
git_diff_merge
(
git_diff
*
onto
,
const
git_diff
*
from
)
int
git_diff__merge_deltas
(
git_diff
*
onto
,
const
git_diff
*
from
,
git_diff__merge_cb
cb
)
{
int
error
=
0
;
git_pool
onto_pool
;
...
...
@@ -154,7 +155,7 @@ int git_diff_merge(git_diff *onto, const git_diff *from)
const
git_diff_delta
*
left
=
reversed
?
f
:
o
;
const
git_diff_delta
*
right
=
reversed
?
o
:
f
;
delta
=
diff_delta__merge_like_cgit
(
left
,
right
,
&
onto_pool
);
delta
=
cb
(
left
,
right
,
&
onto_pool
);
i
++
;
j
++
;
}
...
...
@@ -162,7 +163,7 @@ int git_diff_merge(git_diff *onto, const git_diff *from)
/* the ignore rules for the target may not match the source
* or the result of a merged delta could be skippable...
*/
if
(
git_diff_delta__should_skip
(
&
onto
->
opts
,
delta
))
{
if
(
delta
&&
git_diff_delta__should_skip
(
&
onto
->
opts
,
delta
))
{
git__free
(
delta
);
continue
;
}
...
...
@@ -193,6 +194,11 @@ int git_diff_merge(git_diff *onto, const git_diff *from)
return
error
;
}
int
git_diff_merge
(
git_diff
*
onto
,
const
git_diff
*
from
)
{
return
git_diff__merge_deltas
(
onto
,
from
,
diff_delta__merge_like_cgit
);
}
int
git_diff_find_similar__hashsig_for_file
(
void
**
out
,
const
git_diff_file
*
f
,
const
char
*
path
,
void
*
p
)
{
...
...
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