Branch Coverage

deps/libgit2/src/diff_file.c
Criterion Covered Total %
branch 69 136 50.7


line true false branch
23 89 60 if ((fc->file->flags & DIFF_FLAGS_KNOWN_BINARY) == 0 &&
89 0 if ((fc->file->flags & DIFF_FLAGS_KNOWN_BINARY) == 0 &&
24 0 89 fc->opts_max_size > 0 &&
33 40 60 if ((fc->file->flags & DIFF_FLAGS_KNOWN_BINARY) != 0)
47 100 0 fc->opts_flags = opts ? opts->flags : GIT_DIFF_NORMAL;
49 100 0 if (opts && opts->max_size >= 0)
100 0 if (opts && opts->max_size >= 0)
50 0 100 fc->opts_max_size = opts->max_size ?
53 2 98 if (fc->src == GIT_ITERATOR_EMPTY)
68 0 100 else if (fc->opts_flags & GIT_DIFF_FORCE_TEXT) {
73 4 96 else if (fc->opts_flags & GIT_DIFF_FORCE_BINARY) {
80 47 53 if ((fc->flags & GIT_DIFF_FLAG__NO_DATA) != 0) {
86 49 51 if ((fc->flags & GIT_DIFF_FLAG__LOADED) != 0)
102 49 49 fc->file = use_old ? &delta->old_file : &delta->new_file;
103 49 49 fc->src = use_old ? diff->old_src : diff->new_src;
105 0 98 if (git_diff_driver_lookup(&fc->driver, fc->repo,
115 7 7 has_data = !use_old &&
0 7 has_data = !use_old &&
128 47 51 if (!has_data)
145 1 1 if (!src->blob && !src->buf) {
0 1 if (!src->blob && !src->buf) {
152 1 1 if (src->blob) {
164 0 1 if ((error = git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB)) < 0)
184 0 0 if (check_status) {
190 0 0 if ((error = git_submodule_lookup(&sm, fc->repo, fc->file->path)) < 0) {
192 0 0 if (error == GIT_EEXISTS) {
199 0 0 if ((error = git_submodule_status(&sm_status, fc->repo, fc->file->path, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0) {
205 0 0 if ((fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0 &&
0 0 if ((fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0 &&
206 0 0 ((sm_head = git_submodule_wd_id(sm)) != NULL ||
213 0 0 if (GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
220 0 0 if (git_buf_printf(&content, "Subproject commit %s%s\n", oid, status) < 0)
237 0 47 if (git_oid_is_zero(&fc->file->id))
240 0 47 if (fc->file->mode == GIT_FILEMODE_COMMIT)
244 13 34 if (!fc->file->size) {
245 0 13 if ((error = git_diff_file__resolve_zero_size(
254 0 47 if (odb_obj != NULL) {
263 47 0 if (!error) {
278 0 0 if ((error = git_futils_readbuffer(&target, path->ptr)) < 0)
295 0 0 if ((error = git_repository__configmap_lookup(
299 0 0 if (!symlink_supported)
308 0 0 GIT_ERROR_CHECK_ALLOC(fc->map.data);
313 0 0 if (read_len < 0) {
332 0 4 if (fd < 0)
335 0 4 if (!fc->file->size)
338 4 0 if (error < 0 || !fc->file->size)
4 0 if (error < 0 || !fc->file->size)
345 0 4 if ((error = git_filter_list_load(
351 4 0 if (fl == NULL) {
352 4 0 if (!(error = git_futils_mmap_ro(
362 0 0 if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
367 0 0 if (out.ptr != raw.ptr)
370 0 0 if (!error) {
391 0 4 if (fc->file->mode == GIT_FILEMODE_COMMIT)
394 0 4 if (fc->file->mode == GIT_FILEMODE_TREE)
397 0 4 if (git_buf_joinpath(
401 0 4 if (S_ISLNK(fc->file->mode))
407 4 0 if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
4 0 if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
423 49 51 if ((fc->flags & GIT_DIFF_FLAG__LOADED) != 0)
426 2 49 if ((fc->file->flags & GIT_DIFF_FLAG_BINARY) != 0 &&
0 2 if ((fc->file->flags & GIT_DIFF_FLAG_BINARY) != 0 &&
430 4 47 if (fc->src == GIT_ITERATOR_WORKDIR)
434 0 51 if (error)
446 0 100 if ((fc->flags & GIT_DIFF_FLAG__LOADED) == 0)
449 0 100 if (fc->flags & GIT_DIFF_FLAG__FREE_DATA) {
455 4 96 else if (fc->flags & GIT_DIFF_FLAG__UNMAP_DATA) {
462 48 52 if (fc->flags & GIT_DIFF_FLAG__FREE_BLOB) {