From d1cd99244f96bd95bbd67cc737248df346dec08b Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 25 Apr 2024 03:50:51 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@8e652dd2cb69928ea1596aa3e59845fef6854e2c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dex.git.c.ecafe65200a95f92fc10a3095d9e5f09.html | 1092 ++++++++++++++++++++ 1 file changed, 1092 insertions(+) create mode 100644 coverage/index.git.c.ecafe65200a95f92fc10a3095d9e5f09.html (limited to 'coverage/index.git.c.ecafe65200a95f92fc10a3095d9e5f09.html') diff --git a/coverage/index.git.c.ecafe65200a95f92fc10a3095d9e5f09.html b/coverage/index.git.c.ecafe65200a95f92fc10a3095d9e5f09.html new file mode 100644 index 0000000..a82cde7 --- /dev/null +++ b/coverage/index.git.c.ecafe65200a95f92fc10a3095d9e5f09.html @@ -0,0 +1,1092 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/git.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:395570.9%
Branches:106415.6%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2022 Egor Tensin <egor@tensin.name>
3 + * This file is part of the "cimple" project.
4 + * For details, see https://github.com/egor-tensin/cimple.
5 + * Distributed under the MIT License.
6 + */
7 +
8 + #include "git.h"
9 + #include "log.h"
10 +
11 + #include <git2.h>
12 +
13 + #include <stdlib.h>
14 +
15 + #define git_log_err(fn) \
16 + do { \
17 + const git_error *error = git_error_last(); \
18 + const char *msg = error && error->message ? error->message : "???"; \
19 + log_err("%s: %s\n", fn, msg); \
20 + } while (0)
21 +
22 + 54int libgit_init(void)
23 + {
24 + 54 int ret = 0;
25 +
26 + 54 ret = git_libgit2_init();
27 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 54 times.
+
+
+
54 if (ret < 0) {
28 + git_log_err("git_libgit2_init");
29 + return ret;
30 + }
31 +
32 + 54 return 0;
33 + }
34 +
35 + 54void libgit_shutdown(void)
36 + {
37 + 54 git_libgit2_shutdown();
38 + 54}
39 +
40 + 9180int libgit_clone(git_repository **repo, const char *url, const char *dir)
41 + {
42 + git_clone_options opts;
43 + 9180 int ret = 0;
44 +
45 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 9180 times.
+
+
+
9180 log("Cloning git repository from %s to %s\n", url, dir);
46 +
47 + 9180 ret = git_clone_options_init(&opts, GIT_CLONE_OPTIONS_VERSION);
48 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0) {
49 + git_log_err("git_clone_options_init");
50 + return ret;
51 + }
52 + 9180 opts.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
53 +
54 + 9180 ret = git_clone(repo, url, dir, &opts);
55 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0) {
56 + git_log_err("git_clone");
57 + return ret;
58 + }
59 +
60 + 9180 return 0;
61 + }
62 +
63 + 9180int libgit_clone_to_tmp(git_repository **repo, const char *url)
64 + {
65 + 9180 char dir[] = "/tmp/git.XXXXXX";
66 +
67 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 9180 times.
+
+
+
9180 if (!mkdtemp(dir)) {
68 + log_errno("mkdtemp");
69 + return -1;
70 + }
71 +
72 + 9180 return libgit_clone(repo, url, dir);
73 + }
74 +
75 + 9180void libgit_repository_free(git_repository *repo)
76 + {
77 + 9180 git_repository_free(repo);
78 + 9180}
79 +
80 + 9180int libgit_checkout(git_repository *repo, const char *rev)
81 + {
82 + git_checkout_options opts;
83 + git_object *obj;
84 + 9180 int ret = 0;
85 +
86 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 9180 times.
+
+
+
9180 log("Checking out revision %s\n", rev);
87 +
88 + 9180 ret = git_revparse_single(&obj, repo, rev);
89 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0) {
90 + git_log_err("git_revparse_single");
91 + return ret;
92 + }
93 +
94 + 9180 ret = git_checkout_options_init(&opts, GIT_CHECKOUT_OPTIONS_VERSION);
95 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0) {
96 + git_log_err("git_checkout_options_init");
97 + goto free_obj;
98 + }
99 + 9180 opts.checkout_strategy = GIT_CHECKOUT_FORCE;
100 +
101 + 9180 ret = git_checkout_tree(repo, obj, &opts);
102 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0) {
103 + git_log_err("git_checkout_tree");
104 + goto free_obj;
105 + }
106 +
107 + 9180 ret = git_repository_set_head_detached(repo, git_object_id(obj));
108 +
+ 1/2 +
+
✓ Branch 0 taken 9180 times.
+
✗ Branch 1 not taken.
+
+
+
9180 if (ret < 0) {
109 + git_log_err("git_repository_set_head_detached");
110 + goto free_obj;
111 + }
112 +
113 + 9180free_obj:
114 + 9180 git_object_free(obj);
115 +
116 + 9180 return ret;
117 + }
118 +
+
+ +
+ + + + -- cgit v1.2.3