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
8dd8aa48
Commit
8dd8aa48
authored
Jul 26, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some warnings
parent
a16e4172
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
19 deletions
+20
-19
src/array.h
+6
-5
src/blob.c
+1
-1
src/diff_patch.c
+13
-13
No files found.
src/array.h
View file @
8dd8aa48
...
...
@@ -39,25 +39,26 @@
#define GITERR_CHECK_ARRAY(a) GITERR_CHECK_ALLOC((a).ptr)
typedef
git_array_t
(
void
)
git_array_generic_t
;
typedef
git_array_t
(
char
)
git_array_generic_t
;
/* use a generic array for growth so this can return the new item */
GIT_INLINE
(
void
*
)
git_array_grow
(
git_array_generic_t
*
a
,
size_t
item_size
)
GIT_INLINE
(
void
*
)
git_array_grow
(
void
*
_
a
,
size_t
item_size
)
{
git_array_generic_t
*
a
=
_a
;
uint32_t
new_size
=
(
a
->
size
<
8
)
?
8
:
a
->
asize
*
3
/
2
;
void
*
new_array
=
git__realloc
(
a
->
ptr
,
new_size
*
item_size
);
char
*
new_array
=
git__realloc
(
a
->
ptr
,
new_size
*
item_size
);
if
(
!
new_array
)
{
git_array_clear
(
*
a
);
return
NULL
;
}
else
{
a
->
ptr
=
new_array
;
a
->
asize
=
new_size
;
a
->
size
++
;
return
(((
char
*
)
a
->
ptr
)
+
(
a
->
size
-
1
)
*
item_size
)
;
return
a
->
ptr
+
(
a
->
size
-
1
)
*
item_size
;
}
}
#define git_array_alloc(a) \
((a).size >= (a).asize) ? \
git_array_grow(
(git_array_generic_t *)&(a), sizeof(*(a).ptr)) :
\
git_array_grow(
&(a), sizeof(*(a).ptr)) :
\
(a).ptr ? &(a).ptr[(a).size++] : NULL
#define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : NULL)
...
...
src/blob.c
View file @
8dd8aa48
...
...
@@ -195,7 +195,7 @@ int git_blob__create_from_paths(
size
=
st
.
st_size
;
mode
=
hint_mode
?
hint_mode
:
st
.
st_mode
;
if
(
S_ISLNK
(
hint_
mode
))
{
if
(
S_ISLNK
(
mode
))
{
error
=
write_symlink
(
oid
,
odb
,
content_path
,
(
size_t
)
size
);
}
else
{
git_vector
write_filters
=
GIT_VECTOR_INIT
;
...
...
src/diff_patch.c
View file @
8dd8aa48
...
...
@@ -288,8 +288,8 @@ int git_diff_foreach(
if
(
diff_required
(
diff
,
"git_diff_foreach"
)
<
0
)
return
-
1
;
diff_output_init
(
(
git_diff_output
*
)
&
xo
,
&
diff
->
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
diff_output_init
(
&
xo
.
output
,
&
diff
->
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
git_xdiff_init
(
&
xo
,
&
diff
->
opts
);
git_vector_foreach
(
&
diff
->
deltas
,
idx
,
patch
.
delta
)
{
...
...
@@ -300,10 +300,10 @@ int git_diff_foreach(
if
(
!
(
error
=
diff_patch_init_from_diff
(
&
patch
,
diff
,
idx
)))
{
error
=
diff_patch_file_callback
(
&
patch
,
(
git_diff_output
*
)
&
xo
);
error
=
diff_patch_file_callback
(
&
patch
,
&
xo
.
output
);
if
(
!
error
)
error
=
diff_patch_generate
(
&
patch
,
(
git_diff_output
*
)
&
xo
);
error
=
diff_patch_generate
(
&
patch
,
&
xo
.
output
);
git_diff_patch_free
(
&
patch
);
}
...
...
@@ -441,7 +441,7 @@ int git_diff_blobs(
memset
(
&
xo
,
0
,
sizeof
(
xo
));
diff_output_init
(
(
git_diff_output
*
)
&
xo
,
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
&
xo
.
output
,
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
git_xdiff_init
(
&
xo
,
opts
);
if
(
!
old_path
&&
new_path
)
...
...
@@ -452,7 +452,7 @@ int git_diff_blobs(
error
=
diff_patch_from_blobs
(
&
pd
,
&
xo
,
old_blob
,
old_path
,
new_blob
,
new_path
,
opts
);
git_diff_patch_free
(
(
git_diff_patch
*
)
&
pd
);
git_diff_patch_free
(
&
pd
.
patch
);
return
error
;
}
...
...
@@ -477,7 +477,7 @@ int git_diff_patch_from_blobs(
memset
(
&
xo
,
0
,
sizeof
(
xo
));
diff_output_to_patch
(
(
git_diff_output
*
)
&
xo
,
&
pd
->
patch
);
diff_output_to_patch
(
&
xo
.
output
,
&
pd
->
patch
);
git_xdiff_init
(
&
xo
,
opts
);
error
=
diff_patch_from_blobs
(
...
...
@@ -553,7 +553,7 @@ int git_diff_blob_to_buffer(
memset
(
&
xo
,
0
,
sizeof
(
xo
));
diff_output_init
(
(
git_diff_output
*
)
&
xo
,
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
&
xo
.
output
,
opts
,
file_cb
,
hunk_cb
,
data_cb
,
payload
);
git_xdiff_init
(
&
xo
,
opts
);
if
(
!
old_path
&&
buf_path
)
...
...
@@ -564,7 +564,7 @@ int git_diff_blob_to_buffer(
error
=
diff_patch_from_blob_and_buffer
(
&
pd
,
&
xo
,
old_blob
,
old_path
,
buf
,
buflen
,
buf_path
,
opts
);
git_diff_patch_free
(
(
git_diff_patch
*
)
&
pd
);
git_diff_patch_free
(
&
pd
.
patch
);
return
error
;
}
...
...
@@ -590,7 +590,7 @@ int git_diff_patch_from_blob_and_buffer(
memset
(
&
xo
,
0
,
sizeof
(
xo
));
diff_output_to_patch
(
(
git_diff_output
*
)
&
xo
,
&
pd
->
patch
);
diff_output_to_patch
(
&
xo
.
output
,
&
pd
->
patch
);
git_xdiff_init
(
&
xo
,
opts
);
error
=
diff_patch_from_blob_and_buffer
(
...
...
@@ -642,13 +642,13 @@ int git_diff_get_patch(
if
((
error
=
diff_patch_alloc_from_diff
(
&
patch
,
diff
,
idx
))
<
0
)
return
error
;
diff_output_to_patch
(
(
git_diff_output
*
)
&
xo
,
patch
);
diff_output_to_patch
(
&
xo
.
output
,
patch
);
git_xdiff_init
(
&
xo
,
&
diff
->
opts
);
error
=
diff_patch_file_callback
(
patch
,
(
git_diff_output
*
)
&
xo
);
error
=
diff_patch_file_callback
(
patch
,
&
xo
.
output
);
if
(
!
error
)
error
=
diff_patch_generate
(
patch
,
(
git_diff_output
*
)
&
xo
);
error
=
diff_patch_generate
(
patch
,
&
xo
.
output
);
if
(
!
error
)
{
/* if cumulative diff size is < 0.5 total size, flatten the patch */
...
...
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