diff options
Diffstat (limited to 'src/ci.c')
| -rw-r--r-- | src/ci.c | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -34,70 +34,70 @@ static const char *ci_env[] = { /* clang-format on */ static int ci_run_script(const char* script, struct process_output* result) { - const char* args[] = {script, NULL}; - return process_execute_and_capture(args, ci_env, result); + const char* args[] = {script, NULL}; + return process_execute_and_capture(args, ci_env, result); } int ci_run(struct process_output* result) { - for (const char** script = ci_scripts; *script; ++script) { - if (!file_exists(*script)) - continue; - log("Going to run: %s\n", *script); - return ci_run_script(*script, result); - } + for (const char** script = ci_scripts; *script; ++script) { + if (!file_exists(*script)) + continue; + log("Going to run: %s\n", *script); + return ci_run_script(*script, result); + } - log("Couldn't find any CI scripts to run\n"); - return -1; + log("Couldn't find any CI scripts to run\n"); + return -1; } static void ci_cleanup_git_repo(git_repository* repo) { - rm_rf(git_repository_workdir(repo)); - libgit_repository_free(repo); + rm_rf(git_repository_workdir(repo)); + libgit_repository_free(repo); } static int ci_prepare_git_repo(git_repository** repo, const char* url, const char* rev) { - int ret = 0; + int ret = 0; - ret = libgit_clone_to_tmp(repo, url); - if (ret < 0) - return ret; + ret = libgit_clone_to_tmp(repo, url); + if (ret < 0) + return ret; - ret = libgit_checkout(*repo, rev); - if (ret < 0) - goto cleanup_repo; + ret = libgit_checkout(*repo, rev); + if (ret < 0) + goto cleanup_repo; - return ret; + return ret; cleanup_repo: - ci_cleanup_git_repo(*repo); + ci_cleanup_git_repo(*repo); - return ret; + return ret; } int ci_run_git_repo(const char* url, const char* rev, struct process_output* output) { - char* oldpwd = NULL; - git_repository* repo = NULL; - int ret = 0; + char* oldpwd = NULL; + git_repository* repo = NULL; + int ret = 0; - ret = ci_prepare_git_repo(&repo, url, rev); - if (ret < 0) - goto exit; + ret = ci_prepare_git_repo(&repo, url, rev); + if (ret < 0) + goto exit; - ret = chdir_wrapper(git_repository_workdir(repo), &oldpwd); - if (ret < 0) - goto free_repo; + ret = chdir_wrapper(git_repository_workdir(repo), &oldpwd); + if (ret < 0) + goto free_repo; - ret = ci_run(output); - if (ret < 0) - goto oldpwd; + ret = ci_run(output); + if (ret < 0) + goto oldpwd; oldpwd: - chdir_wrapper(oldpwd, NULL); - free(oldpwd); + chdir_wrapper(oldpwd, NULL); + free(oldpwd); free_repo: - ci_cleanup_git_repo(repo); + ci_cleanup_git_repo(repo); exit: - return ret; + return ret; } |
