Branch Coverage

deps/libgit2/src/libgit2/sysdir.c
Criterion Covered Total %
branch 32 102 31.3


line true false branch
48 0 0 GIT_ASSERT_ARG(out);
50 0 0 if ((buflen = sysconf(_SC_GETPW_R_SIZE_MAX)) == -1)
57 0 0 } while (error == ERANGE && buflen <= 8192);
0 0 } while (error == ERANGE && buflen <= 8192);
59 0 0 if (error) {
64 0 0 if (!pwdptr) {
69 0 0 if ((error = git_str_puts(out, pwdptr->pw_dir)) < 0)
103 87 0 if (!sandbox_id && uid == euid)
87 0 if (!sandbox_id && uid == euid)
108 0 87 if (error == GIT_ENOTFOUND) {
133 87 0 if (uid == euid) {
134 0 87 if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0)
137 87 0 if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
87 0 if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
140 0 0 if ((error = get_passwd_home(&env, euid)) == 0)
144 0 87 if (error == GIT_ENOTFOUND) {
180 0 0 for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
189 522 0 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
435 87 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
192 0 87 if (error)
203 0 0 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); ++i) {
0 0 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); ++i) {
213 1293 0 if (which < ARRAY_SIZE(git_sysdir__dirs))
223 0 1293 GIT_ASSERT_ARG(out);
227 0 1293 GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
240 0 0 GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
242 0 0 if (search_path != NULL)
246 0 0 if (!search_path)
250 0 0 if (!expand_path) {
251 0 0 if (search_path)
258 0 0 if (expand_path > search_path)
261 0 0 if (git_str_len(&git_sysdir__dirs[which].buf))
266 0 0 if (*expand_path)
273 0 0 if (git_str_oom(&git_sysdir__dirs[which].buf))
289 0 1292 GIT_ERROR_CHECK_ERROR(git_sysdir_get(&syspath, which));
290 1292 0 if (!syspath || !git_str_len(syspath))
1222 70 if (!syspath || !git_str_len(syspath))
293 1222 1153 for (scan = git_str_cstr(syspath); scan; scan = next) {
295 6284 1222 for (next = scan; *next; ++next) {
296 0 6284 if (*next == GIT_PATH_LIST_SEPARATOR &&
0 0 if (*next == GIT_PATH_LIST_SEPARATOR &&
297 0 0 (next <= scan || next[-1] != '\\'))
302 0 1222 next = (*next ? next + 1 : NULL);
303 0 1222 if (!len)
306 0 1222 GIT_ERROR_CHECK_ERROR(git_str_set(path, scan, len));
307 1222 0 if (name)
308 0 1222 GIT_ERROR_CHECK_ERROR(git_str_joinpath(path, path->ptr, name));
310 69 1153 if (git_fs_path_exists(path->ptr))
315 1223 0 if (name)
357 0 0 if ((error = git_sysdir_find_global_file(path, NULL)) == 0) {
358 0 0 if (filename)