#include "log.h" #include "util.h" #include #include #include #include #include #define TMP_PATH "/tmp/confer" char *repo_clone(char *url) { git_libgit2_init(); git_repository *repo = NULL; int random = randint(100, 999); char path[strlen(TMP_PATH) + 4]; sprintf(path, "%s_%d", TMP_PATH, random); if (git_clone(&repo, url, path, NULL) != 0) { error("Failed to clone the repository: " COLOR_RESET "%s", git_error_last()->message); return NULL; } git_libgit2_shutdown(); return strdup(path); }