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
ef6b12b0
Commit
ef6b12b0
authored
Apr 05, 2020
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revwalk: use GIT_ASSERT
parent
5bd139e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
14 deletions
+31
-14
src/revwalk.c
+31
-14
No files found.
src/revwalk.c
View file @
ef6b12b0
...
@@ -99,7 +99,8 @@ int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
...
@@ -99,7 +99,8 @@ int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
oid
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
oid
);
return
git_revwalk__push_commit
(
walk
,
oid
,
&
opts
);
return
git_revwalk__push_commit
(
walk
,
oid
,
&
opts
);
}
}
...
@@ -108,7 +109,9 @@ int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
...
@@ -108,7 +109,9 @@ int git_revwalk_push(git_revwalk *walk, const git_oid *oid)
int
git_revwalk_hide
(
git_revwalk
*
walk
,
const
git_oid
*
oid
)
int
git_revwalk_hide
(
git_revwalk
*
walk
,
const
git_oid
*
oid
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
oid
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
oid
);
opts
.
uninteresting
=
1
;
opts
.
uninteresting
=
1
;
return
git_revwalk__push_commit
(
walk
,
oid
,
&
opts
);
return
git_revwalk__push_commit
(
walk
,
oid
,
&
opts
);
...
@@ -133,7 +136,8 @@ int git_revwalk__push_glob(git_revwalk *walk, const char *glob, const git_revwal
...
@@ -133,7 +136,8 @@ int git_revwalk__push_glob(git_revwalk *walk, const char *glob, const git_revwal
git_reference_iterator
*
iter
;
git_reference_iterator
*
iter
;
size_t
wildcard
;
size_t
wildcard
;
assert
(
walk
&&
glob
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
glob
);
if
(
given_opts
)
if
(
given_opts
)
memcpy
(
&
opts
,
given_opts
,
sizeof
(
opts
));
memcpy
(
&
opts
,
given_opts
,
sizeof
(
opts
));
...
@@ -172,7 +176,9 @@ out:
...
@@ -172,7 +176,9 @@ out:
int
git_revwalk_push_glob
(
git_revwalk
*
walk
,
const
char
*
glob
)
int
git_revwalk_push_glob
(
git_revwalk
*
walk
,
const
char
*
glob
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
glob
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
glob
);
return
git_revwalk__push_glob
(
walk
,
glob
,
&
opts
);
return
git_revwalk__push_glob
(
walk
,
glob
,
&
opts
);
}
}
...
@@ -180,7 +186,9 @@ int git_revwalk_push_glob(git_revwalk *walk, const char *glob)
...
@@ -180,7 +186,9 @@ int git_revwalk_push_glob(git_revwalk *walk, const char *glob)
int
git_revwalk_hide_glob
(
git_revwalk
*
walk
,
const
char
*
glob
)
int
git_revwalk_hide_glob
(
git_revwalk
*
walk
,
const
char
*
glob
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
glob
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
glob
);
opts
.
uninteresting
=
1
;
opts
.
uninteresting
=
1
;
return
git_revwalk__push_glob
(
walk
,
glob
,
&
opts
);
return
git_revwalk__push_glob
(
walk
,
glob
,
&
opts
);
...
@@ -189,7 +197,8 @@ int git_revwalk_hide_glob(git_revwalk *walk, const char *glob)
...
@@ -189,7 +197,8 @@ int git_revwalk_hide_glob(git_revwalk *walk, const char *glob)
int
git_revwalk_push_head
(
git_revwalk
*
walk
)
int
git_revwalk_push_head
(
git_revwalk
*
walk
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
);
GIT_ASSERT_ARG
(
walk
);
return
git_revwalk__push_ref
(
walk
,
GIT_HEAD_FILE
,
&
opts
);
return
git_revwalk__push_ref
(
walk
,
GIT_HEAD_FILE
,
&
opts
);
}
}
...
@@ -197,7 +206,8 @@ int git_revwalk_push_head(git_revwalk *walk)
...
@@ -197,7 +206,8 @@ int git_revwalk_push_head(git_revwalk *walk)
int
git_revwalk_hide_head
(
git_revwalk
*
walk
)
int
git_revwalk_hide_head
(
git_revwalk
*
walk
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
);
GIT_ASSERT_ARG
(
walk
);
opts
.
uninteresting
=
1
;
opts
.
uninteresting
=
1
;
return
git_revwalk__push_ref
(
walk
,
GIT_HEAD_FILE
,
&
opts
);
return
git_revwalk__push_ref
(
walk
,
GIT_HEAD_FILE
,
&
opts
);
...
@@ -206,7 +216,9 @@ int git_revwalk_hide_head(git_revwalk *walk)
...
@@ -206,7 +216,9 @@ int git_revwalk_hide_head(git_revwalk *walk)
int
git_revwalk_push_ref
(
git_revwalk
*
walk
,
const
char
*
refname
)
int
git_revwalk_push_ref
(
git_revwalk
*
walk
,
const
char
*
refname
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
refname
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
refname
);
return
git_revwalk__push_ref
(
walk
,
refname
,
&
opts
);
return
git_revwalk__push_ref
(
walk
,
refname
,
&
opts
);
}
}
...
@@ -249,7 +261,10 @@ out:
...
@@ -249,7 +261,10 @@ out:
int
git_revwalk_hide_ref
(
git_revwalk
*
walk
,
const
char
*
refname
)
int
git_revwalk_hide_ref
(
git_revwalk
*
walk
,
const
char
*
refname
)
{
{
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
git_revwalk__push_options
opts
=
GIT_REVWALK__PUSH_OPTIONS_INIT
;
assert
(
walk
&&
refname
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
refname
);
opts
.
uninteresting
=
1
;
opts
.
uninteresting
=
1
;
return
git_revwalk__push_ref
(
walk
,
refname
,
&
opts
);
return
git_revwalk__push_ref
(
walk
,
refname
,
&
opts
);
}
}
...
@@ -694,13 +709,14 @@ void git_revwalk_free(git_revwalk *walk)
...
@@ -694,13 +709,14 @@ void git_revwalk_free(git_revwalk *walk)
git_repository
*
git_revwalk_repository
(
git_revwalk
*
walk
)
git_repository
*
git_revwalk_repository
(
git_revwalk
*
walk
)
{
{
assert
(
walk
);
GIT_ASSERT_ARG_WITH_RETVAL
(
walk
,
NULL
);
return
walk
->
repo
;
return
walk
->
repo
;
}
}
int
git_revwalk_sorting
(
git_revwalk
*
walk
,
unsigned
int
sort_mode
)
int
git_revwalk_sorting
(
git_revwalk
*
walk
,
unsigned
int
sort_mode
)
{
{
assert
(
walk
);
GIT_ASSERT_ARG
(
walk
);
if
(
walk
->
walking
)
if
(
walk
->
walking
)
git_revwalk_reset
(
walk
);
git_revwalk_reset
(
walk
);
...
@@ -732,7 +748,8 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
...
@@ -732,7 +748,8 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
int
error
;
int
error
;
git_commit_list_node
*
next
;
git_commit_list_node
*
next
;
assert
(
walk
&&
oid
);
GIT_ASSERT_ARG
(
walk
);
GIT_ASSERT_ARG
(
oid
);
if
(
!
walk
->
walking
)
{
if
(
!
walk
->
walking
)
{
if
((
error
=
prepare_walk
(
walk
))
<
0
)
if
((
error
=
prepare_walk
(
walk
))
<
0
)
...
@@ -757,7 +774,7 @@ int git_revwalk_reset(git_revwalk *walk)
...
@@ -757,7 +774,7 @@ int git_revwalk_reset(git_revwalk *walk)
{
{
git_commit_list_node
*
commit
;
git_commit_list_node
*
commit
;
assert
(
walk
);
GIT_ASSERT_ARG
(
walk
);
git_oidmap_foreach_value
(
walk
->
commits
,
commit
,
{
git_oidmap_foreach_value
(
walk
->
commits
,
commit
,
{
commit
->
seen
=
0
;
commit
->
seen
=
0
;
...
@@ -787,7 +804,7 @@ int git_revwalk_add_hide_cb(
...
@@ -787,7 +804,7 @@ int git_revwalk_add_hide_cb(
git_revwalk_hide_cb
hide_cb
,
git_revwalk_hide_cb
hide_cb
,
void
*
payload
)
void
*
payload
)
{
{
assert
(
walk
);
GIT_ASSERT_ARG
(
walk
);
if
(
walk
->
walking
)
if
(
walk
->
walking
)
git_revwalk_reset
(
walk
);
git_revwalk_reset
(
walk
);
...
...
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