@@ -234,6 +234,17 @@ def test_clone_from_keeps_env(self, rw_dir):
234234
235235 self.assertEqual(environment, cloned.git.environment())
236236
237+ @pytest.mark.skipif(os.name != "nt", reason="Specifically for Windows drive-rooted paths.")
238+ @with_rw_directory
239+ def test_clone_from_drive_rooted_destination(self, rw_dir):
240+ original_repo = Repo.init(osp.join(rw_dir, "repo"))
241+ destination = osp.join(rw_dir, "clone")
242+ _drive, rooted_destination = osp.splitdrive(destination)
243+
244+ cloned = Repo.clone_from(original_repo.git_dir, rooted_destination)
245+
246+ assert osp.samefile(cloned.working_tree_dir, destination)
247+
237248 @with_rw_directory
238249 def test_date_format(self, rw_dir):
239250 repo = Repo.init(osp.join(rw_dir, "repo"))
@@ -1222,6 +1233,25 @@ def test_git_work_tree_dotgit_relative(self):
12221233 # test_git_work_tree_dotgit; delegate instead
12231234 self.test_git_work_tree_dotgit(use_relative_paths=True)
12241235
1236+ @pytest.mark.skipif(os.name != "nt", reason="Specifically for Windows drive-rooted paths.")
1237+ @with_rw_directory
1238+ def test_linked_worktree_drive_rooted_gitdir_file(self, rw_dir):
1239+ main_repo = self.rorepo.clone(join_path_native(rw_dir, "main_repo"))
1240+ branch = main_repo.create_head("drive-rooted-worktree")
1241+ worktree_path = join_path_native(rw_dir, "worktree_repo")
1242+ main_repo.git.worktree("add", worktree_path, branch.name)
1243+
1244+ linked_repo = Repo(worktree_path)
1245+ gitdir_file = osp.join(linked_repo.git_dir, "gitdir")
1246+ worktree_gitfile = osp.join(worktree_path, ".git")
1247+ _drive, rooted_worktree_gitfile = osp.splitdrive(worktree_gitfile)
1248+ with open(gitdir_file, "w") as stream:
1249+ stream.write(rooted_worktree_gitfile)
1250+
1251+ reopened_repo = Repo(linked_repo.git_dir)
1252+
1253+ assert osp.samefile(reopened_repo.working_tree_dir, worktree_path)
1254+
12251255 @with_rw_directory
12261256 def test_git_work_tree_env(self, rw_dir):
12271257 """Check that we yield to GIT_WORK_TREE."""
0 commit comments