Branch Coverage

deps/libgit2/src/libgit2/tag.c
Criterion Covered Total %
branch 52 168 30.9


line true false branch
29 0 1 GIT_ASSERT_ARG(t);
35 0 0 GIT_ASSERT_ARG_WITH_RETVAL(t, NULL);
41 0 0 GIT_ASSERT_ARG_WITH_RETVAL(t, GIT_OBJECT_INVALID);
47 0 3 GIT_ASSERT_ARG_WITH_RETVAL(t, NULL);
58 0 2 GIT_ASSERT_ARG_WITH_RETVAL(t, NULL);
78 0 1 if (git_oid__parse(&tag->target, &buffer, buffer_end, "object ") < 0)
81 0 1 if (buffer + 5 >= buffer_end)
84 0 1 if (memcmp(buffer, "type ", 5) != 0)
90 1 0 for (i = 1; i < ARRAY_SIZE(tag_types); ++i) {
93 0 1 if (buffer + type_length >= buffer_end)
96 1 0 if (memcmp(buffer, tag_types[i], type_length) == 0) {
103 0 1 if (tag->type == GIT_OBJECT_INVALID)
106 0 1 if (buffer + 4 >= buffer_end)
109 0 1 if (memcmp(buffer, "tag ", 4) != 0)
115 0 1 if (search == NULL)
120 0 1 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
0 1 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
122 0 1 GIT_ERROR_CHECK_ALLOC(tag->tag_name);
130 1 0 if (buffer < buffer_end && *buffer != '\n') {
1 0 if (buffer < buffer_end && *buffer != '\n') {
132 0 1 GIT_ERROR_CHECK_ALLOC(tag->tagger);
134 0 1 if ((error = git_signature__parse(tag->tagger, &buffer, buffer_end, "tagger ", '\n')) < 0)
139 1 0 if (buffer < buffer_end) {
141 0 1 if(*buffer != '\n') {
144 0 0 if (search)
152 0 1 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
0 1 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, text_len, 1);
154 0 1 GIT_ERROR_CHECK_ALLOC(tag->message);
188 0 1 if (git_str_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
192 0 1 if (error < 0)
206 0 1 if (git_str_joinpath(ref_name_out, GIT_REFS_TAGS_DIR, tag_name) < 0)
229 0 1 if (git_str_puts(&tag, message) < 0)
232 0 1 if (git_repository_odb__weakptr(&odb, repo) < 0)
235 0 1 if (git_odb_write(oid, odb, tag.ptr, tag.size, GIT_OBJECT_TAG) < 0)
271 0 1 GIT_ASSERT_ARG(repo);
272 0 1 GIT_ASSERT_ARG(tag_name);
273 0 1 GIT_ASSERT_ARG(target);
274 1 0 GIT_ASSERT_ARG(!create_tag_annotation || (tagger && message));
1 0 GIT_ASSERT_ARG(!create_tag_annotation || (tagger && message));
0 1 GIT_ASSERT_ARG(!create_tag_annotation || (tagger && message));
276 0 1 if (git_object_owner(target) != repo) {
281 0 1 if (!tag_name_is_valid(tag_name)) {
287 1 0 if (error < 0 && error != GIT_ENOTFOUND)
0 1 if (error < 0 && error != GIT_ENOTFOUND)
292 0 1 if (error == 0 && !allow_ref_overwrite) {
0 0 if (error == 0 && !allow_ref_overwrite) {
298 1 0 if (create_tag_annotation) {
299 0 1 if (write_tag_annotation(oid, repo, tag_name, target, tagger, message) < 0)
332 0 0 GIT_ASSERT_ARG(oid);
333 0 0 GIT_ASSERT_ARG(repo);
334 0 0 GIT_ASSERT_ARG(tag_name);
335 0 0 GIT_ASSERT_ARG(target);
336 0 0 GIT_ASSERT_ARG(tagger);
337 0 0 GIT_ASSERT_ARG(message);
363 0 0 GIT_ASSERT_ARG(oid);
364 0 0 GIT_ASSERT_ARG(buffer);
368 0 0 if (git_repository_odb__weakptr(&odb, repo) < 0)
372 0 0 if (tag_parse(&tag, buffer, buffer + strlen(buffer)) < 0)
376 0 0 if (git_odb_read(&target_obj, odb, &tag.target) < 0)
379 0 0 if (tag.type != target_obj->cached.type) {
385 0 0 if (error < 0 && error != GIT_ENOTFOUND)
0 0 if (error < 0 && error != GIT_ENOTFOUND)
396 0 0 if (error == 0 && !allow_ref_overwrite) {
0 0 if (error == 0 && !allow_ref_overwrite) {
402 0 0 if ((error = git_odb_open_wstream(
406 0 0 if (!(error = git_odb_stream_write(stream, buffer, strlen(buffer))))
411 0 0 if (error < 0) {
442 0 1 if (error < 0)
464 90 9 if (git__prefixcmp(ref, GIT_REFS_TAGS_DIR) != 0)
467 9 0 if (!(error = git_reference_name_to_id(&oid, d->repo, ref))) {
468 1 8 if ((error = d->cb(ref, &oid, d->cb_data)) != 0)
479 0 16 GIT_ASSERT_ARG(repo);
480 0 16 GIT_ASSERT_ARG(cb);
505 0 0 GIT_ERROR_CHECK_ALLOC(matched);
519 0 0 GIT_ASSERT_ARG(tag_names);
520 0 0 GIT_ASSERT_ARG(repo);
521 0 0 GIT_ASSERT_ARG(pattern);
523 0 0 if ((error = git_vector_init(&taglist, 8, NULL)) < 0)
531 0 0 if (error < 0)
555 0 0 GIT_ASSERT(valid);
559 0 0 if (!name || !tag_name_is_valid(name))
0 0 if (!name || !tag_name_is_valid(name))
562 0 0 if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||
0 0 if ((error = git_str_puts(&ref_name, GIT_REFS_TAGS_DIR)) < 0 ||