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
c6e84bce
Commit
c6e84bce
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply: use GIT_ASSERT
parent
f60ebfcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
src/apply.c
+16
-7
No files found.
src/apply.c
View file @
c6e84bce
...
@@ -5,8 +5,6 @@
...
@@ -5,8 +5,6 @@
* a Linking Exception. For full terms see the included COPYING file.
* a Linking Exception. For full terms see the included COPYING file.
*/
*/
#include "apply.h"
#include "git2/apply.h"
#include "git2/apply.h"
#include "git2/patch.h"
#include "git2/patch.h"
#include "git2/filter.h"
#include "git2/filter.h"
...
@@ -21,6 +19,7 @@
...
@@ -21,6 +19,7 @@
#include "zstream.h"
#include "zstream.h"
#include "reader.h"
#include "reader.h"
#include "index.h"
#include "index.h"
#include "apply.h"
typedef
struct
{
typedef
struct
{
/* The lines that we allocate ourself are allocated out of the pool.
/* The lines that we allocate ourself are allocated out of the pool.
...
@@ -399,7 +398,11 @@ int git_apply__patch(
...
@@ -399,7 +398,11 @@ int git_apply__patch(
unsigned
int
mode
=
0
;
unsigned
int
mode
=
0
;
int
error
=
0
;
int
error
=
0
;
assert
(
contents_out
&&
filename_out
&&
mode_out
&&
(
source
||
!
source_len
)
&&
patch
);
GIT_ASSERT_ARG
(
contents_out
);
GIT_ASSERT_ARG
(
filename_out
);
GIT_ASSERT_ARG
(
mode_out
);
GIT_ASSERT_ARG
(
source
||
!
source_len
);
GIT_ASSERT_ARG
(
patch
);
if
(
given_opts
)
if
(
given_opts
)
memcpy
(
&
ctx
.
opts
,
given_opts
,
sizeof
(
git_apply_options
));
memcpy
(
&
ctx
.
opts
,
given_opts
,
sizeof
(
git_apply_options
));
...
@@ -624,7 +627,10 @@ int git_apply_to_tree(
...
@@ -624,7 +627,10 @@ int git_apply_to_tree(
size_t
i
;
size_t
i
;
int
error
=
0
;
int
error
=
0
;
assert
(
out
&&
repo
&&
preimage
&&
diff
);
GIT_ASSERT_ARG
(
out
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
preimage
);
GIT_ASSERT_ARG
(
diff
);
*
out
=
NULL
;
*
out
=
NULL
;
...
@@ -772,6 +778,8 @@ done:
...
@@ -772,6 +778,8 @@ done:
int
git_apply_options_init
(
git_apply_options
*
opts
,
unsigned
int
version
)
int
git_apply_options_init
(
git_apply_options
*
opts
,
unsigned
int
version
)
{
{
GIT_ASSERT_ARG
(
opts
);
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
GIT_INIT_STRUCTURE_FROM_TEMPLATE
(
opts
,
version
,
git_apply_options
,
GIT_APPLY_OPTIONS_INIT
);
opts
,
version
,
git_apply_options
,
GIT_APPLY_OPTIONS_INIT
);
return
0
;
return
0
;
...
@@ -805,7 +813,8 @@ int git_apply(
...
@@ -805,7 +813,8 @@ int git_apply(
git_apply_options
opts
=
GIT_APPLY_OPTIONS_INIT
;
git_apply_options
opts
=
GIT_APPLY_OPTIONS_INIT
;
int
error
=
GIT_EINVALID
;
int
error
=
GIT_EINVALID
;
assert
(
repo
&&
diff
);
GIT_ASSERT_ARG
(
repo
);
GIT_ASSERT_ARG
(
diff
);
GIT_ERROR_CHECK_VERSION
(
GIT_ERROR_CHECK_VERSION
(
given_opts
,
GIT_APPLY_OPTIONS_VERSION
,
"git_apply_options"
);
given_opts
,
GIT_APPLY_OPTIONS_VERSION
,
"git_apply_options"
);
...
@@ -829,7 +838,7 @@ int git_apply(
...
@@ -829,7 +838,7 @@ int git_apply(
error
=
git_reader_for_workdir
(
&
pre_reader
,
repo
,
false
);
error
=
git_reader_for_workdir
(
&
pre_reader
,
repo
,
false
);
break
;
break
;
default:
default:
assert
(
false
);
GIT_ASSERT
(
false
);
}
}
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -869,7 +878,7 @@ int git_apply(
...
@@ -869,7 +878,7 @@ int git_apply(
error
=
git_apply__to_workdir
(
repo
,
diff
,
preimage
,
postimage
,
location
,
&
opts
);
error
=
git_apply__to_workdir
(
repo
,
diff
,
preimage
,
postimage
,
location
,
&
opts
);
break
;
break
;
default:
default:
assert
(
false
);
GIT_ASSERT
(
false
);
}
}
if
(
error
<
0
)
if
(
error
<
0
)
...
...
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