Commit 3428a523597a75127bf258b6d74c2871df5e8f0d

Patrick Steinhardt 2017-02-08T12:02:32

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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/tests/repo/discover.c b/tests/repo/discover.c
index 48aa275..abb7bd1 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
Binary files a/tests/resources/testrepo.git/index and b/tests/resources/testrepo.git/index differ