Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/core/libgit2/src/test-init.c
1067 views
1
/*
2
A little test of libgit2 + cowasm.
3
4
Make a git repo from scratch.
5
*/
6
7
#include <stdio.h>
8
#include "git2.h"
9
10
int main(int argc, char** argv) {
11
if (argc < 2) {
12
fprintf(stderr, "usage: %s path\n", argv[0]);
13
return 1;
14
}
15
if (git_libgit2_init() < 0) {
16
fprintf(stderr, "ERROR in git_libgit2_init: %s\n", git_error_last()->message);
17
return 1;
18
}
19
20
git_repository* repo = NULL;
21
int status = git_repository_init(&repo, argv[1], 0);
22
if (status < 0) {
23
fprintf(stderr, "ERROR in git_libgit2_init: %s\n", git_error_last()->message);
24
return 1;
25
}
26
printf("git init succeeded: %s\n", argv[1]);
27
return 0;
28
}
29