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
8d44f8b7
Commit
8d44f8b7
authored
Nov 24, 2015
by
Edward Thomson
Committed by
Edward Thomson
May 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
patch: `patch_diff` -> `patch_generated`
parent
53571f2f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
31 deletions
+34
-31
src/diff_print.c
+1
-1
src/diff_stats.c
+1
-1
src/diff_xdiff.c
+8
-8
src/diff_xdiff.h
+5
-5
src/patch_generate.c
+0
-0
src/patch_generate.h
+19
-16
No files found.
src/diff_print.c
View file @
8d44f8b7
...
...
@@ -7,7 +7,7 @@
#include "common.h"
#include "diff.h"
#include "diff_file.h"
#include "patch_
diff
.h"
#include "patch_
generate
.h"
#include "fileops.h"
#include "zstream.h"
#include "blob.h"
...
...
src/diff_stats.c
View file @
8d44f8b7
...
...
@@ -7,7 +7,7 @@
#include "common.h"
#include "vector.h"
#include "diff.h"
#include "patch_
diff
.h"
#include "patch_
generate
.h"
#define DIFF_RENAME_FILE_SEPARATOR " => "
#define STATS_FULL_MIN_SCALE 7
...
...
src/diff_xdiff.c
View file @
8d44f8b7
...
...
@@ -9,7 +9,7 @@
#include "diff.h"
#include "diff_driver.h"
#include "diff_xdiff.h"
#include "patch_
diff
.h"
#include "patch_
generate
.h"
static
int
git_xdiff_scan_int
(
const
char
**
str
,
int
*
value
)
{
...
...
@@ -56,7 +56,7 @@ fail:
typedef
struct
{
git_xdiff_output
*
xo
;
git_patch_
diff
*
patch
;
git_patch_
generated
*
patch
;
git_diff_hunk
hunk
;
int
old_lineno
,
new_lineno
;
mmfile_t
xd_old_data
,
xd_new_data
;
...
...
@@ -110,9 +110,9 @@ static int diff_update_lines(
static
int
git_xdiff_cb
(
void
*
priv
,
mmbuffer_t
*
bufs
,
int
len
)
{
git_xdiff_info
*
info
=
priv
;
git_patch_
diff
*
patch
=
info
->
patch
;
git_patch_
generated
*
patch
=
info
->
patch
;
const
git_diff_delta
*
delta
=
patch
->
base
.
delta
;
git_patch_
diff
_output
*
output
=
&
info
->
xo
->
output
;
git_patch_
generated
_output
*
output
=
&
info
->
xo
->
output
;
git_diff_line
line
;
if
(
len
==
1
)
{
...
...
@@ -181,7 +181,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
return
output
->
error
;
}
static
int
git_xdiff
(
git_patch_
diff_output
*
output
,
git_patch_diff
*
patch
)
static
int
git_xdiff
(
git_patch_
generated_output
*
output
,
git_patch_generated
*
patch
)
{
git_xdiff_output
*
xo
=
(
git_xdiff_output
*
)
output
;
git_xdiff_info
info
;
...
...
@@ -194,7 +194,7 @@ static int git_xdiff(git_patch_diff_output *output, git_patch_diff *patch)
xo
->
callback
.
priv
=
&
info
;
git_diff_find_context_init
(
&
xo
->
config
.
find_func
,
&
findctxt
,
git_patch_
diff
_driver
(
patch
));
&
xo
->
config
.
find_func
,
&
findctxt
,
git_patch_
generated
_driver
(
patch
));
xo
->
config
.
find_func_priv
=
&
findctxt
;
if
(
xo
->
config
.
find_func
!=
NULL
)
...
...
@@ -206,8 +206,8 @@ static int git_xdiff(git_patch_diff_output *output, git_patch_diff *patch)
* updates are needed to xo->params.flags
*/
git_patch_
diff
_old_data
(
&
info
.
xd_old_data
.
ptr
,
&
info
.
xd_old_data
.
size
,
patch
);
git_patch_
diff
_new_data
(
&
info
.
xd_new_data
.
ptr
,
&
info
.
xd_new_data
.
size
,
patch
);
git_patch_
generated
_old_data
(
&
info
.
xd_old_data
.
ptr
,
&
info
.
xd_old_data
.
size
,
patch
);
git_patch_
generated
_new_data
(
&
info
.
xd_new_data
.
ptr
,
&
info
.
xd_new_data
.
size
,
patch
);
if
(
info
.
xd_old_data
.
size
>
GIT_XDIFF_MAX_SIZE
||
info
.
xd_new_data
.
size
>
GIT_XDIFF_MAX_SIZE
)
{
...
...
src/diff_xdiff.h
View file @
8d44f8b7
...
...
@@ -9,19 +9,19 @@
#include "diff.h"
#include "xdiff/xdiff.h"
#include "patch_
diff
.h"
#include "patch_
generate
.h"
/* xdiff cannot cope with large files. these files should not be passed to
* xdiff. callers should treat these large files as binary.
*/
#define GIT_XDIFF_MAX_SIZE (1024LL * 1024 * 1023)
/* A git_xdiff_output is a git_patch_
diff_output with extra fields necessary
*
to use libxdiff. Calling git_xdiff_init() will set the diff_cb field
* of the output to use xdiff to generate the diffs.
/* A git_xdiff_output is a git_patch_
generate_output with extra fields
*
necessary to use libxdiff. Calling git_xdiff_init() will set the diff_cb
*
field
of the output to use xdiff to generate the diffs.
*/
typedef
struct
{
git_patch_
diff
_output
output
;
git_patch_
generated
_output
output
;
xdemitconf_t
config
;
xpparam_t
params
;
...
...
src/patch_
diff
.c
→
src/patch_
generate
.c
View file @
8d44f8b7
This diff is collapsed.
Click to expand it.
src/patch_
diff
.h
→
src/patch_
generate
.h
View file @
8d44f8b7
...
...
@@ -4,8 +4,8 @@
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_
diff_patch
_h__
#define INCLUDE_
diff_patch
_h__
#ifndef INCLUDE_
patch_generate
_h__
#define INCLUDE_
patch_generate
_h__
#include "common.h"
#include "diff.h"
...
...
@@ -13,17 +13,17 @@
#include "patch.h"
enum
{
GIT_PATCH_
DIFF
_ALLOCATED
=
(
1
<<
0
),
GIT_PATCH_
DIFF
_INITIALIZED
=
(
1
<<
1
),
GIT_PATCH_
DIFF
_LOADED
=
(
1
<<
2
),
GIT_PATCH_
GENERATED
_ALLOCATED
=
(
1
<<
0
),
GIT_PATCH_
GENERATED
_INITIALIZED
=
(
1
<<
1
),
GIT_PATCH_
GENERATED
_LOADED
=
(
1
<<
2
),
/* the two sides are different */
GIT_PATCH_
DIFF
_DIFFABLE
=
(
1
<<
3
),
GIT_PATCH_
GENERATED
_DIFFABLE
=
(
1
<<
3
),
/* the difference between the two sides has been computed */
GIT_PATCH_
DIFF
_DIFFED
=
(
1
<<
4
),
GIT_PATCH_
DIFF
_FLATTENED
=
(
1
<<
5
),
GIT_PATCH_
GENERATED
_DIFFED
=
(
1
<<
4
),
GIT_PATCH_
GENERATED
_FLATTENED
=
(
1
<<
5
),
};
struct
git_patch_
diff
{
struct
git_patch_
generated
{
struct
git_patch
base
;
git_diff
*
diff
;
/* for refcount purposes, maybe NULL for blob diffs */
...
...
@@ -34,16 +34,18 @@ struct git_patch_diff {
git_pool
flattened
;
};
typedef
struct
git_patch_
diff
git_patch_diff
;
typedef
struct
git_patch_
generated
git_patch_generated
;
extern
git_diff_driver
*
git_patch_
diff_driver
(
git_patch_diff
*
);
extern
git_diff_driver
*
git_patch_
generated_driver
(
git_patch_generated
*
);
extern
void
git_patch_diff_old_data
(
char
**
,
size_t
*
,
git_patch_diff
*
);
extern
void
git_patch_diff_new_data
(
char
**
,
size_t
*
,
git_patch_diff
*
);
extern
void
git_patch_generated_old_data
(
char
**
,
size_t
*
,
git_patch_generated
*
);
extern
void
git_patch_generated_new_data
(
char
**
,
size_t
*
,
git_patch_generated
*
);
typedef
struct
git_patch_
diff_output
git_patch_diff
_output
;
typedef
struct
git_patch_
generated_output
git_patch_generated
_output
;
struct
git_patch_
diff
_output
{
struct
git_patch_
generated
_output
{
/* these callbacks are issued with the diff data */
git_diff_file_cb
file_cb
;
git_diff_binary_cb
binary_cb
;
...
...
@@ -57,7 +59,8 @@ struct git_patch_diff_output {
/* this callback is used to do the diff and drive the other callbacks.
* see diff_xdiff.h for how to use this in practice for now.
*/
int
(
*
diff_cb
)(
git_patch_diff_output
*
output
,
git_patch_diff
*
patch
);
int
(
*
diff_cb
)(
git_patch_generated_output
*
output
,
git_patch_generated
*
patch
);
};
#endif
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