Skip to content

Instantly share code, notes, and snippets.

@mrosset
Created March 7, 2011 15:33
Show Gist options
  • Select an option

  • Save mrosset/858643 to your computer and use it in GitHub Desktop.

Select an option

Save mrosset/858643 to your computer and use it in GitHub Desktop.
#include <git2.h>
#include <stdio.h>
#define BARE 1
#define NOTBARE 0
int test_repo(const char *path, unsigned type);
int main()
{
const char *tmpdir = "./tmp\0";
printf("beginning test\n");
printf("bare\t\t");
test_repo(tmpdir, BARE);
printf("not bare\t");
test_repo(tmpdir, NOTBARE);
printf("done.\n");
return 0;
}
int test_repo(const char *path, unsigned type)
{
git_repository *repo;
int error = GIT_SUCCESS;
error = git_repository_init(&repo,path,type);
if (error != 0) {
printf("ERROR: init %s code %i\n",path,error);
return error;
};
error = git_repository_open(&repo, path);
if (error != 0) {
printf("ERROR: opening %s code %i\n",path,error);
return error;
};
printf(" pass\n");
git_repository_free(repo);
return error;
}
@mrosset

mrosset commented Mar 7, 2011

Copy link
Copy Markdown
Author

warning: passing argument 1 of 'git_repository_open' from incompatible pointer type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment