From 3428a523597a75127bf258b6d74c2871df5e8f0d Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Wed, 8 Feb 2017 12:02:32 +0100 Subject: [PATCH] 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. --- tests/repo/discover.c | 9 +++++++++ tests/resources/testrepo.git/index | Bin 2 files changed, 9 insertions(+) mode change 100644 => 100755 tests/resources/testrepo.git/index diff --git a/tests/repo/discover.c b/tests/repo/discover.c index 48aa27581..abb7bd12b 100644 --- a/tests/repo/discover.c +++ b/tests/repo/discover.c @@ -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); } + +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 +} diff --git a/tests/resources/testrepo.git/index b/tests/resources/testrepo.git/index old mode 100644 new mode 100755