aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/git.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-09-08 09:04:24 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-09-08 09:04:24 +0200
commit5e64d1c4b78c908e92a65e03fdc6817ffe59a8a6 (patch)
tree6472c8d0bf822c52b633804a39afc05351c0571b /src/git.c
parentlog: prepend timestamps (diff)
downloadcimple-5e64d1c4b78c908e92a65e03fdc6817ffe59a8a6.tar.gz
cimple-5e64d1c4b78c908e92a65e03fdc6817ffe59a8a6.zip
log: refactoring
Diffstat (limited to 'src/git.c')
-rw-r--r--src/git.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/git.c b/src/git.c
index af4eb01..d7f7c69 100644
--- a/src/git.c
+++ b/src/git.c
@@ -5,11 +5,11 @@
#include <stdlib.h>
-#define git_print_error(fn) \
+#define git_log_err(fn) \
do { \
const git_error *error = git_error_last(); \
const char *msg = error && error->message ? error->message : "???"; \
- print_error("%s: %s\n", fn, msg); \
+ log_err("%s: %s\n", fn, msg); \
} while (0)
int libgit_init()
@@ -18,7 +18,7 @@ int libgit_init()
ret = git_libgit2_init();
if (ret < 0) {
- git_print_error("git_libgit2_init");
+ git_log_err("git_libgit2_init");
return ret;
}
@@ -35,18 +35,18 @@ int libgit_clone(git_repository **repo, const char *url, const char *dir)
git_clone_options opts;
int ret = 0;
- print_log("Cloning git repository from %s to %s\n", url, dir);
+ log("Cloning git repository from %s to %s\n", url, dir);
ret = git_clone_options_init(&opts, GIT_CLONE_OPTIONS_VERSION);
if (ret < 0) {
- git_print_error("git_clone_options_init");
+ git_log_err("git_clone_options_init");
return ret;
}
opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
ret = git_clone(repo, url, dir, &opts);
if (ret < 0) {
- git_print_error("git_clone");
+ git_log_err("git_clone");
return ret;
}
@@ -58,7 +58,7 @@ int libgit_clone_to_tmp(git_repository **repo, const char *url)
char dir[] = "/tmp/git.XXXXXX";
if (!mkdtemp(dir)) {
- print_errno("mkdtemp");
+ log_errno("mkdtemp");
return -1;
}
@@ -76,30 +76,30 @@ int libgit_checkout(git_repository *repo, const char *rev)
git_object *obj;
int ret = 0;
- print_log("Checking out revision %s\n", rev);
+ log("Checking out revision %s\n", rev);
ret = git_revparse_single(&obj, repo, rev);
if (ret < 0) {
- git_print_error("git_revparse_single");
+ git_log_err("git_revparse_single");
return ret;
}
ret = git_checkout_options_init(&opts, GIT_CHECKOUT_OPTIONS_VERSION);
if (ret < 0) {
- git_print_error("git_checkout_options_init");
+ git_log_err("git_checkout_options_init");
goto free_obj;
}
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
ret = git_checkout_tree(repo, obj, &opts);
if (ret < 0) {
- git_print_error("git_checkout_tree");
+ git_log_err("git_checkout_tree");
goto free_obj;
}
ret = git_repository_set_head_detached(repo, git_object_id(obj));
if (ret < 0) {
- git_print_error("git_repository_set_head_detached");
+ git_log_err("git_repository_set_head_detached");
goto free_obj;
}