@@ -55,12 +55,12 @@ def init_git_repo(repo_path: pathlib.Path, remote_url: str | None) -> None:
5555 name = "myproject" ,
5656 url = "git+https://github.com/user/myproject.git" ,
5757 workspace_root = None ,
58- path_relative = None ,
58+ path_relative = "myproject" ,
5959 dry_run = False ,
6060 use_default_config = False ,
6161 preexisting_config = None ,
6262 expected_in_config = {
63- ". /" : {
63+ "~ /" : {
6464 "myproject" : {"repo" : "git+https://github.com/user/myproject.git" },
6565 },
6666 },
@@ -99,12 +99,12 @@ def init_git_repo(repo_path: pathlib.Path, remote_url: str | None) -> None:
9999 name = "autoproject" ,
100100 url = "git+https://github.com/user/autoproject.git" ,
101101 workspace_root = None ,
102- path_relative = None ,
102+ path_relative = "autoproject" ,
103103 dry_run = False ,
104104 use_default_config = True ,
105105 preexisting_config = None ,
106106 expected_in_config = {
107- ". /" : {
107+ "~ /" : {
108108 "autoproject" : {
109109 "repo" : "git+https://github.com/user/autoproject.git" ,
110110 },
@@ -125,7 +125,7 @@ def init_git_repo(repo_path: pathlib.Path, remote_url: str | None) -> None:
125125 use_default_config = False ,
126126 preexisting_config = None ,
127127 expected_in_config = {
128- "~/code/lib/ " : {
128+ "~/code/" : {
129129 "lib" : {"repo" : "git+https://github.com/user/lib.git" },
130130 },
131131 },
@@ -136,7 +136,7 @@ def init_git_repo(repo_path: pathlib.Path, remote_url: str | None) -> None:
136136 name = "extra" ,
137137 url = "git+https://github.com/user/extra.git" ,
138138 workspace_root = None ,
139- path_relative = None ,
139+ path_relative = "extra" ,
140140 dry_run = False ,
141141 use_default_config = False ,
142142 preexisting_config = {
@@ -145,10 +145,10 @@ def init_git_repo(repo_path: pathlib.Path, remote_url: str | None) -> None:
145145 },
146146 },
147147 expected_in_config = {
148- "~/code/ " : {
148+ "~/code" : {
149149 "existing" : {"repo" : "git+https://github.com/user/existing.git" },
150150 },
151- ". /" : {
151+ "~ /" : {
152152 "extra" : {"repo" : "git+https://github.com/user/extra.git" },
153153 },
154154 },
@@ -260,13 +260,15 @@ def test_add_repo_duplicate_warning(
260260 monkeypatch .chdir (tmp_path )
261261
262262 config_file = tmp_path / ".vcspull.yaml"
263+ repo_path = tmp_path / "myproject"
264+ repo_path .mkdir ()
263265
264266 # Add repo first time
265267 add_repo (
266268 name = "myproject" ,
267269 url = "git+https://github.com/user/myproject.git" ,
268270 config_file_path_str = str (config_file ),
269- path = None ,
271+ path = str ( repo_path ) ,
270272 workspace_root_path = None ,
271273 dry_run = False ,
272274 )
@@ -279,7 +281,7 @@ def test_add_repo_duplicate_warning(
279281 name = "myproject" ,
280282 url = "git+https://github.com/user/myproject-v2.git" ,
281283 config_file_path_str = str (config_file ),
282- path = None ,
284+ path = str ( repo_path ) ,
283285 workspace_root_path = None ,
284286 dry_run = False ,
285287 )
@@ -299,11 +301,14 @@ def test_add_repo_creates_new_file(
299301 config_file = tmp_path / ".vcspull.yaml"
300302 assert not config_file .exists ()
301303
304+ repo_path = tmp_path / "newrepo"
305+ repo_path .mkdir ()
306+
302307 add_repo (
303308 name = "newrepo" ,
304309 url = "git+https://github.com/user/newrepo.git" ,
305310 config_file_path_str = str (config_file ),
306- path = None ,
311+ path = str ( repo_path ) ,
307312 workspace_root_path = None ,
308313 dry_run = False ,
309314 )
@@ -315,8 +320,8 @@ def test_add_repo_creates_new_file(
315320 with config_file .open () as f :
316321 config = yaml .safe_load (f )
317322
318- assert ". /" in config
319- assert "newrepo" in config [". /" ]
323+ assert "~ /" in config
324+ assert "newrepo" in config ["~ /" ]
320325
321326
322327class AddDuplicateMergeFixture (t .NamedTuple ):
@@ -598,6 +603,42 @@ class PathAddFixture(t.NamedTuple):
598603 expected_workspace_label = "~/study/python/" ,
599604 preserve_config_path_in_log = True ,
600605 ),
606+ PathAddFixture (
607+ test_id = "path-explicit-dot-workspace" ,
608+ remote_url = "https://github.com/example/dot" ,
609+ explicit_url = None ,
610+ assume_yes = True ,
611+ prompt_response = None ,
612+ dry_run = False ,
613+ expected_written = True ,
614+ expected_url_kind = "remote" ,
615+ override_name = None ,
616+ expected_warning = None ,
617+ merge_duplicates = True ,
618+ preexisting_yaml = None ,
619+ use_relative_repo_path = False ,
620+ workspace_override = "./" ,
621+ expected_workspace_label = "./" ,
622+ preserve_config_path_in_log = False ,
623+ ),
624+ PathAddFixture (
625+ test_id = "path-explicit-dot-workspace-no-merge" ,
626+ remote_url = "https://github.com/example/dot-nomerge" ,
627+ explicit_url = None ,
628+ assume_yes = True ,
629+ prompt_response = None ,
630+ dry_run = False ,
631+ expected_written = True ,
632+ expected_url_kind = "remote" ,
633+ override_name = None ,
634+ expected_warning = None ,
635+ merge_duplicates = False ,
636+ preexisting_yaml = None ,
637+ use_relative_repo_path = False ,
638+ workspace_override = "./" ,
639+ expected_workspace_label = "./" ,
640+ preserve_config_path_in_log = False ,
641+ ),
601642]
602643
603644
0 commit comments