Branch Coverage

deps/libgit2/src/blob.c
Criterion Covered Total %
branch 36 120 30.0


line true false branch
21 0 157 assert(blob);
22 0 157 if (blob->raw)
30 0 164 assert(blob);
31 0 164 if (blob->raw)
41 0 0 GIT_ERROR_CHECK_BLOBSIZE(size);
48 178 0 if (!blob->raw)
56 0 0 assert(blob);
66 0 178 assert(blob);
80 16 0 assert(id && repo);
0 16 assert(id && repo);
82 16 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 16 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
86 16 0 if ((error = git_odb_stream_write(stream, buffer, len)) == 0)
102 0 47 if ((error = git_odb_open_wstream(
106 0 47 if ((fd = git_futils_open_ro(path)) < 0) {
111 93 0 while (!error && (read_len = p_read(fd, buffer, sizeof(buffer))) > 0) {
46 47 while (!error && (read_len = p_read(fd, buffer, sizeof(buffer))) > 0) {
118 47 0 if (written != file_size || read_len < 0) {
0 47 if (written != file_size || read_len < 0) {
123 47 0 if (!error)
143 15 2 if (!error) {
161 0 0 GIT_ERROR_CHECK_ALLOC(link_data);
164 0 0 if (read_len != (ssize_t)link_size) {
191 0 64 assert(hint_path || !try_load_filters);
0 0 assert(hint_path || !try_load_filters);
193 64 0 if (!content_path) {
194 0 64 if (git_repository__ensure_not_bare(repo, "create blob from file") < 0)
197 0 64 if (git_buf_joinpath(
204 64 0 if ((error = git_path_lstat(content_path, &st)) < 0 ||
64 0 if ((error = git_path_lstat(content_path, &st)) < 0 ||
208 0 64 if (S_ISDIR(st.st_mode)) {
214 64 0 if (out_st)
218 64 0 mode = hint_mode ? hint_mode : st.st_mode;
220 0 64 if (S_ISLNK(mode)) {
225 64 0 if (try_load_filters)
231 64 0 if (error < 0)
233 47 17 else if (fl == NULL)
279 0 0 if ((error = git_path_prettify(&full_path, path, NULL)) < 0) {
287 0 0 if (workdir && !git__prefixcmp(hintpath, workdir))
0 0 if (workdir && !git__prefixcmp(hintpath, workdir))
334 0 0 assert(out && repo);
0 0 assert(out && repo);
337 0 0 GIT_ERROR_CHECK_ALLOC(stream);
339 0 0 if (hintpath) {
341 0 0 GIT_ERROR_CHECK_ALLOC(stream->hintpath);
349 0 0 if ((error = git_repository_item_path(&path, repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0
350 0 0 || (error = git_buf_joinpath(&path, path.ptr, "streamed")) < 0)
353 0 0 if ((error = git_filebuf_open_withsize(&stream->fbuf, git_buf_cstr(&path), GIT_FILEBUF_TEMPORARY,
360 0 0 if (error < 0)
377 0 0 if ((error = git_filebuf_flush(&stream->fbuf)) < 0)
394 0 10 assert(blob);
414 0 0 assert(blob && path && out);
0 0 assert(blob && path && out);
0 0 assert(blob && path && out);
418 0 0 GIT_ERROR_CHECK_VERSION(
421 0 0 if (given_opts != NULL)
428 0 0 if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
431 0 0 if ((opts.flags & GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD) != 0)
434 0 0 if (!(error = git_filter_list_load(
487 0 0 if (check_for_binary_data)