Branch Coverage

deps/libgit2/src/libgit2/diff_file.c
Criterion Covered Total %
branch 69 134 51.4


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_str_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) {
333 0 4 if (fd < 0)
338 0 4 if (error < 0)
341 0 4 if (!(fc->file->flags & GIT_DIFF_FLAG_VALID_SIZE)) {
344 0 4 } else if (fc->file->size != new_file_size) {
354 0 4 if ((error = git_filter_list_load(
360 4 0 if (fl == NULL) {
361 4 0 if (!(error = git_futils_mmap_ro(
371 0 0 if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
376 0 0 if (!error) {
397 0 4 if (fc->file->mode == GIT_FILEMODE_COMMIT)
400 0 4 if (fc->file->mode == GIT_FILEMODE_TREE)
403 0 4 if (git_repository_workdir_path(&path, fc->repo, fc->file->path) < 0)
406 0 4 if (S_ISLNK(fc->file->mode))
412 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) {
428 49 51 if ((fc->flags & GIT_DIFF_FLAG__LOADED) != 0)
431 2 49 if ((fc->file->flags & GIT_DIFF_FLAG_BINARY) != 0 &&
0 2 if ((fc->file->flags & GIT_DIFF_FLAG_BINARY) != 0 &&
435 4 47 if (fc->src == GIT_ITERATOR_WORKDIR)
439 0 51 if (error)
451 0 100 if ((fc->flags & GIT_DIFF_FLAG__LOADED) == 0)
454 0 100 if (fc->flags & GIT_DIFF_FLAG__FREE_DATA) {
460 4 96 else if (fc->flags & GIT_DIFF_FLAG__UNMAP_DATA) {
467 48 52 if (fc->flags & GIT_DIFF_FLAG__FREE_BLOB) {