mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 11:50:27 +00:00
init.c example: deploy more helpers
This commit is contained in:
parent
e568bedf52
commit
7cc3c9bf00
@ -47,9 +47,8 @@ int main(int argc, char *argv[])
|
|||||||
/* No options were specified, so let's demonstrate the default
|
/* No options were specified, so let's demonstrate the default
|
||||||
* simple case of git_repository_init() API usage...
|
* simple case of git_repository_init() API usage...
|
||||||
*/
|
*/
|
||||||
|
check_lg2(git_repository_init(&repo, o.dir, 0),
|
||||||
if (git_repository_init(&repo, o.dir, 0) < 0)
|
"Could not initialize repository", NULL);
|
||||||
fatal("Could not initialize repository", o.dir);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* Some command line options were specified, so we'll use the
|
/* 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)
|
if (o.shared != 0)
|
||||||
initopts.mode = o.shared;
|
initopts.mode = o.shared;
|
||||||
|
|
||||||
if (git_repository_init_ext(&repo, o.dir, &initopts) < 0) {
|
check_lg2(git_repository_init_ext(&repo, o.dir, &initopts),
|
||||||
const git_error *err = giterr_last();
|
"Could not initialize repository", NULL);
|
||||||
fatal("Could not initialize repository:", err->message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print a message to stdout like "git init" does */
|
/* Print a message to stdout like "git init" does */
|
||||||
|
Loading…
Reference in New Issue
Block a user