Skip to content

Commit 3428a52

Browse files
committed
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.
1 parent 9e8d75c commit 3428a52

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/repo/discover.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,12 @@ void test_repo_discover__discovery_starting_at_file_succeeds(void)
199199

200200
ensure_repository_discover(SUB_REPOSITORY_FOLDER "/file", ceiling_dirs.ptr, SUB_REPOSITORY_GITDIR);
201201
}
202+
203+
void test_repo_discover__discovery_starting_at_system_root_causes_no_hang(void)
204+
{
205+
#ifdef GIT_WIN32
206+
git_buf out = GIT_BUF_INIT;
207+
cl_git_fail(git_repository_discover(&out, "C:/", 0, NULL));
208+
cl_git_fail(git_repository_discover(&out, "//localhost/", 0, NULL));
209+
#endif
210+
}

tests/resources/testrepo.git/index

100644100755
File mode changed.

0 commit comments

Comments
 (0)