From 1ac069bf2825009f91012a95ec64f8cffc8bc5db Mon Sep 17 00:00:00 2001 From: Chewing_Bever Date: Mon, 5 Sep 2022 13:56:43 +0200 Subject: [PATCH] Initial commit --- git2/git2.c.v | 15 +++++++++++++++ git2/git2.v | 16 ++++++++++++++++ main.v | 5 +++++ 3 files changed, 36 insertions(+) create mode 100644 git2/git2.c.v create mode 100644 git2/git2.v create mode 100644 main.v diff --git a/git2/git2.c.v b/git2/git2.c.v new file mode 100644 index 0000000..82cae92 --- /dev/null +++ b/git2/git2.c.v @@ -0,0 +1,15 @@ +module git2 + +#flag -lgit2 + +#include "git2.h" + +pub struct C.git_repository {} + +pub struct C.git_clone_options {} + +fn C.git_libgit2_init() + +fn C.git_libgit2_shutdown() + +fn C.git_clone(&&C.git_repository, &char, &char, &C.git_clone_options) int diff --git a/git2/git2.v b/git2/git2.v new file mode 100644 index 0000000..f6918dc --- /dev/null +++ b/git2/git2.v @@ -0,0 +1,16 @@ +module git2 + +fn init() { + C.git_libgit2_init() +} + +pub fn clone(url string, path string) !&C.git_repository { + out := &C.git_repository{} + res := C.git_clone(&out, url.str, path.str, 0) + + if res != 0 { + return error('Exit code $res') + } + + return out +} diff --git a/main.v b/main.v new file mode 100644 index 0000000..88bee84 --- /dev/null +++ b/main.v @@ -0,0 +1,5 @@ +import git2 + +fn main() { + git2.clone("https://aur.archlinux.org/vlang.git", "test")! +}