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
3dc92940
Commit
3dc92940
authored
Feb 05, 2015
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2875 from JIghtuse/master
for-each-ref example: initialize libgit2 in main
parents
3983935b
2107dac3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
examples/for-each-ref.c
+3
-0
No files found.
examples/for-each-ref.c
View file @
3dc92940
...
@@ -34,6 +34,7 @@ static int show_ref(git_reference *ref, void *data)
...
@@ -34,6 +34,7 @@ static int show_ref(git_reference *ref, void *data)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
git_repository
*
repo
;
git_repository
*
repo
;
git_libgit2_init
();
if
(
argc
!=
1
||
argv
[
1
]
/* silence -Wunused-parameter */
)
if
(
argc
!=
1
||
argv
[
1
]
/* silence -Wunused-parameter */
)
fatal
(
"Sorry, no for-each-ref options supported yet"
,
NULL
);
fatal
(
"Sorry, no for-each-ref options supported yet"
,
NULL
);
...
@@ -42,5 +43,7 @@ int main(int argc, char **argv)
...
@@ -42,5 +43,7 @@ int main(int argc, char **argv)
"Could not open repository"
,
NULL
);
"Could not open repository"
,
NULL
);
check_lg2
(
git_reference_foreach
(
repo
,
show_ref
,
repo
),
check_lg2
(
git_reference_foreach
(
repo
,
show_ref
,
repo
),
"Could not iterate over references"
,
NULL
);
"Could not iterate over references"
,
NULL
);
git_libgit2_shutdown
();
return
0
;
return
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