Skip to content

Instantly share code, notes, and snippets.

@minshallj
Created January 25, 2015 18:46
Show Gist options
  • Save minshallj/8e8eee00e03f5f5c1da2 to your computer and use it in GitHub Desktop.
Save minshallj/8e8eee00e03f5f5c1da2 to your computer and use it in GitHub Desktop.
default: all
CFLAGS += -I/home/jacob/dev/libgit2/include
LDFLAGS += -L/home/jacob/dev/libgit2/build
LIBRARIES += -lgit2
OBJECTS = sample.o
all: $(OBJECTS)
gcc $(CFLAGS) $(LDFLAGS) -o out.out $(OBJECTS) $(LIBRARIES)
#include <git2.h>
#include <stdio.h>
int main()
{
git_repository *repo = NULL;
//const char *url = "file:///tmp/test-repo";
const char *url = "file:///home/jacob/dev/libgit2";
const char *path = "/tmp/test-dest";
const git_error *e;
int error;
git_libgit2_init();
printf("before clone\n");
error = git_clone(&repo, url, path, NULL);
printf("after clone\n");
if (error < 0) {
e = giterr_last();
printf("Error %d/%d: %s\n", error, e->klass, e->message);
exit(error);
}
git_libgit2_shutdown();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment