summaryrefslogtreecommitdiff
path: root/examples/for-each-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/for-each-ref.c')
-rw-r--r--examples/for-each-ref.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/examples/for-each-ref.c b/examples/for-each-ref.c
index 3bc25fcf2..eea73d2fc 100644
--- a/examples/for-each-ref.c
+++ b/examples/for-each-ref.c
@@ -31,19 +31,15 @@ static int show_ref(git_reference *ref, void *data)
return 0;
}
-int main(int argc, char **argv)
+int lg2_for_each_ref(git_repository *repo, int argc, char **argv)
{
- git_repository *repo;
- git_libgit2_init();
+ UNUSED(argv);
- if (argc != 1 || argv[1] /* silence -Wunused-parameter */)
+ if (argc != 1)
fatal("Sorry, no for-each-ref options supported yet", NULL);
- check_lg2(git_repository_open(&repo, "."),
- "Could not open repository", NULL);
check_lg2(git_reference_foreach(repo, show_ref, repo),
"Could not iterate over references", NULL);
- git_libgit2_shutdown();
return 0;
}