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
af817202
Commit
af817202
authored
Feb 01, 2014
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revwalk: remove usage of foreach
parent
d465e4e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
src/revwalk.c
+14
-11
No files found.
src/revwalk.c
View file @
af817202
...
...
@@ -180,17 +180,12 @@ struct push_cb_data {
int
hide
;
};
static
int
push_glob_cb
(
const
char
*
refname
,
void
*
data_
)
{
struct
push_cb_data
*
data
=
(
struct
push_cb_data
*
)
data_
;
return
push_ref
(
data
->
walk
,
refname
,
data
->
hide
,
true
);
}
static
int
push_glob
(
git_revwalk
*
walk
,
const
char
*
glob
,
int
hide
)
{
int
error
=
0
;
git_buf
buf
=
GIT_BUF_INIT
;
struct
push_cb_data
data
;
git_reference
*
ref
;
git_reference_iterator
*
iter
;
size_t
wildcard
;
assert
(
walk
&&
glob
);
...
...
@@ -208,12 +203,20 @@ static int push_glob(git_revwalk *walk, const char *glob, int hide)
if
(
!
glob
[
wildcard
])
git_buf_put
(
&
buf
,
"/*"
,
2
);
data
.
walk
=
walk
;
data
.
hide
=
hide
;
if
((
error
=
git_reference_iterator_glob_new
(
&
iter
,
walk
->
repo
,
buf
.
ptr
))
<
0
)
goto
out
;
error
=
git_reference_foreach_glob
(
walk
->
repo
,
git_buf_cstr
(
&
buf
),
push_glob_cb
,
&
data
);
while
((
error
=
git_reference_next
(
&
ref
,
iter
))
==
0
)
{
error
=
push_ref
(
walk
,
git_reference_name
(
ref
),
hide
,
true
);
git_reference_free
(
ref
);
if
(
error
<
0
)
break
;
}
git_reference_iterator_free
(
iter
);
if
(
error
==
GIT_ITEROVER
)
error
=
0
;
out:
git_buf_free
(
&
buf
);
return
error
;
}
...
...
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