Skip to content

Commit eca9e1c

Browse files
authored
Merge pull request libgit2#6228 from libgit2/ethomson/win32_systemdirs
win32: `find_system_dirs` does not return `GIT_ENOTFOUND`
2 parents 1551b1f + f45121e commit eca9e1c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/win32/findfile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int git_win32__find_system_dirs(git_str *out, const char *subdir)
222222
has_regdir = (find_sysdir_in_registry(regdir) == 0);
223223

224224
if (!has_pathdir && !has_regdir)
225-
return GIT_ENOTFOUND;
225+
return 0;
226226

227227
/*
228228
* Usually the git in the path is the same git in the registry,

tests/win32/systemdir.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,3 +326,13 @@ void test_win32_systemdir__prefers_path_to_registry(void)
326326
git_config_free(cfg);
327327
#endif
328328
}
329+
330+
void test_win32_systemdir__no_git_installed(void)
331+
{
332+
#ifdef GIT_WIN32
333+
git_str out = GIT_STR_INIT;
334+
335+
cl_git_pass(git_win32__find_system_dirs(&out, "etc"));
336+
cl_assert_equal_s(out.ptr, "");
337+
#endif
338+
}

0 commit comments

Comments
 (0)