diff options
author | Ben Straub <bs@github.com> | 2013-10-30 06:09:08 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-10-30 06:09:08 -0700 |
commit | 7cc3c9bf00788e0d91f1a495a28b12509c5bd89d (patch) | |
tree | 1be418959bdc1cb2c85474a67517699489da9645 /examples/init.c | |
parent | e568bedf526693e2a8aab5811364ae5a3a16f4e2 (diff) | |
download | libgit2-7cc3c9bf00788e0d91f1a495a28b12509c5bd89d.tar.gz |
init.c example: deploy more helpers
Diffstat (limited to 'examples/init.c')
-rw-r--r-- | examples/init.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/init.c b/examples/init.c index d05788e10..5bec17b9d 100644 --- a/examples/init.c +++ b/examples/init.c @@ -47,9 +47,8 @@ int main(int argc, char *argv[]) /* No options were specified, so let's demonstrate the default * simple case of git_repository_init() API usage... */ - - if (git_repository_init(&repo, o.dir, 0) < 0) - fatal("Could not initialize repository", o.dir); + check_lg2(git_repository_init(&repo, o.dir, 0), + "Could not initialize repository", NULL); } else { /* Some command line options were specified, so we'll use the @@ -78,10 +77,8 @@ int main(int argc, char *argv[]) if (o.shared != 0) initopts.mode = o.shared; - if (git_repository_init_ext(&repo, o.dir, &initopts) < 0) { - const git_error *err = giterr_last(); - fatal("Could not initialize repository:", err->message); - } + check_lg2(git_repository_init_ext(&repo, o.dir, &initopts), + "Could not initialize repository", NULL); } /* Print a message to stdout like "git init" does */ |