aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/git.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-25 16:58:38 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-26 04:05:02 +0200
commit532b3ae9b5cd8609237e04db768cc1f750d8631d (patch)
treef65253a6ce9970d1d93e6bb6c65758d6fa98373a /src/git.h
parentcmake: ignore unused parameters for now (diff)
downloadcimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.tar.gz
cimple-532b3ae9b5cd8609237e04db768cc1f750d8631d.zip
add some more code
This adds a basic "worker" program. You can now do something like ./server & ./worker & ./client ci_run URL REV and the server should pass a message to worker, after which it should clone the repository at URL, checkout REV, and try to run the CI script. It's extremely unfinished: I need to sort out the graceful shutdown, how the server manages workers, etc.
Diffstat (limited to 'src/git.h')
-rw-r--r--src/git.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/git.h b/src/git.h
new file mode 100644
index 0000000..83b9c49
--- /dev/null
+++ b/src/git.h
@@ -0,0 +1,19 @@
+#ifndef __GIT_H__
+#define __GIT_H__
+
+#include <git2.h>
+
+int libgit_init();
+void libgit_shutdown();
+
+/* These never check out any files (so that we don't have to do 2 checkouts). */
+int libgit_clone(git_repository **, const char *url, const char *dir);
+int libgit_clone_to_tmp(git_repository **, const char *url);
+
+/* Free a cloned repository. */
+void libgit_repository_free(git_repository *);
+
+/* I tried to make this an equivalent of `git checkout`. */
+int libgit_checkout(git_repository *, const char *rev);
+
+#endif