tests: repo: assert discovery starting at Win32 roots finishes

As of recently, we failed to correctly discover repositories at a
Win32 system root. Instead of aborting the upwards-traversal of
the file system, we were looping infinitely when traversal
started at either a Win32 drive prefix ("C:/") or a network path
("//somehost").

The issue has been fixed, so add a test to catch regressions.
This commit is contained in:
Patrick Steinhardt 2017-02-08 12:02:32 +01:00
parent 9e8d75c7d4
commit 3428a52359
2 changed files with 9 additions and 0 deletions

View File

@ -199,3 +199,12 @@ void test_repo_discover__discovery_starting_at_file_succeeds(void)
ensure_repository_discover(SUB_REPOSITORY_FOLDER "/file", ceiling_dirs.ptr, SUB_REPOSITORY_GITDIR); ensure_repository_discover(SUB_REPOSITORY_FOLDER "/file", ceiling_dirs.ptr, SUB_REPOSITORY_GITDIR);
} }
void test_repo_discover__discovery_starting_at_system_root_causes_no_hang(void)
{
#ifdef GIT_WIN32
git_buf out = GIT_BUF_INIT;
cl_git_fail(git_repository_discover(&out, "C:/", 0, NULL));
cl_git_fail(git_repository_discover(&out, "//localhost/", 0, NULL));
#endif
}

0
tests/resources/testrepo.git/index Normal file → Executable file
View File