Branch Coverage

deps/libgit2/src/sysdir.c
Criterion Covered Total %
branch 29 94 30.8


line true false branch
48 0 0 assert(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_buf_puts(out, pwdptr->pw_dir)) < 0)
103 86 0 if (!sandbox_id && uid == euid)
86 0 if (!sandbox_id && uid == euid)
108 0 86 if (error == GIT_ENOTFOUND) {
133 86 0 if (uid == euid) {
134 0 86 if ((error = git__getenv(&env, "XDG_CONFIG_HOME")) == 0)
137 86 0 if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
86 0 if (error == GIT_ENOTFOUND && (error = git__getenv(&env, "HOME")) == 0)
140 0 0 if ((error = get_passwd_home(&env, euid)) == 0)
144 0 86 if (error == GIT_ENOTFOUND) {
180 0 0 for (i = 0; i < ARRAY_SIZE(git_sysdir__dirs); ++i)
189 516 0 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
430 86 for (i = 0; !error && i < ARRAY_SIZE(git_sysdir__dirs); i++)
199 1368 0 if (which < ARRAY_SIZE(git_sysdir__dirs))
209 0 1368 assert(out);
213 0 1368 GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
226 0 0 GIT_ERROR_CHECK_ERROR(git_sysdir_check_selector(which));
228 0 0 if (search_path != NULL)
232 0 0 if (!search_path)
236 0 0 if (!expand_path) {
237 0 0 if (search_path)
244 0 0 if (expand_path > search_path)
247 0 0 if (git_buf_len(&git_sysdir__dirs[which].buf))
252 0 0 if (*expand_path)
259 0 0 if (git_buf_oom(&git_sysdir__dirs[which].buf))
275 0 1304 GIT_ERROR_CHECK_ERROR(git_sysdir_get(&syspath, which));
276 1304 0 if (!syspath || !git_buf_len(syspath))
1240 64 if (!syspath || !git_buf_len(syspath))
279 1240 1240 for (scan = git_buf_cstr(syspath); scan; scan = next) {
281 6272 1240 for (next = scan; *next; ++next) {
282 0 6272 if (*next == GIT_PATH_LIST_SEPARATOR &&
0 0 if (*next == GIT_PATH_LIST_SEPARATOR &&
283 0 0 (next <= scan || next[-1] != '\\'))
288 0 1240 next = (*next ? next + 1 : NULL);
289 0 1240 if (!len)
292 0 1240 GIT_ERROR_CHECK_ERROR(git_buf_set(path, scan, len));
293 1240 0 if (name)
294 0 1240 GIT_ERROR_CHECK_ERROR(git_buf_joinpath(path, path->ptr, name));
296 0 1240 if (git_path_exists(path->ptr))
340 0 0 if ((error = git_sysdir_find_global_file(path, NULL)) == 0) {
341 0 0 if (filename)