@@ -97,6 +97,28 @@ class ConfigVariationTest(t.NamedTuple):
97
97
""" ,
98
98
remote_list = ["secondremote" ],
99
99
),
100
+ ConfigVariationTest (
101
+ test_id = "expanded_repo_style_with_unprefixed_remote" ,
102
+ config_tpl = """
103
+ {tmp_path}/study/myrepo:
104
+ {CLONE_NAME}:
105
+ repo: git+file://{dir}
106
+ remotes:
107
+ git_scheme_repo: [email protected] :tmux-python/tmuxp.git
108
+ """ ,
109
+ remote_list = ["git_scheme_repo" ],
110
+ ),
111
+ ConfigVariationTest (
112
+ test_id = "expanded_repo_style_with_unprefixed_remote_2" ,
113
+ config_tpl = """
114
+ {tmp_path}/study/myrepo:
115
+ {CLONE_NAME}:
116
+ repo: git+file://{dir}
117
+ remotes:
118
+ git_scheme_repo: [email protected] :tony/vcspull.git
119
+ """ ,
120
+ remote_list = ["git_scheme_repo" ],
121
+ ),
100
122
]
101
123
102
124
@@ -131,7 +153,6 @@ def test_config_variations(
131
153
assert len (repos ) == 1
132
154
133
155
for repo_dict in repos :
134
- repo_url = repo_dict ["url" ].replace ("git+" , "" )
135
156
repo : GitSync = update_repo (repo_dict )
136
157
remotes = repo .remotes () or {}
137
158
remote_names = set (remotes .keys ())
@@ -142,7 +163,26 @@ def test_config_variations(
142
163
for remote_name in remotes :
143
164
current_remote = repo .remote (remote_name )
144
165
assert current_remote is not None
145
- assert current_remote .fetch_url == repo_url
166
+ assert repo_dict is not None
167
+ assert isinstance (remote_name , str )
168
+ if (
169
+ "remotes" in repo_dict
170
+ and isinstance (repo_dict ["remotes" ], dict )
171
+ and remote_name in repo_dict ["remotes" ]
172
+ ):
173
+ if repo_dict ["remotes" ][remote_name ].fetch_url .startswith (
174
+ "git+file://"
175
+ ):
176
+ assert current_remote .fetch_url == repo_dict ["remotes" ][
177
+ remote_name
178
+ ].fetch_url .replace (
179
+ "git+" , ""
180
+ ), "Final git remote should chop git+ prefix"
181
+ else :
182
+ assert (
183
+ current_remote .fetch_url
184
+ == repo_dict ["remotes" ][remote_name ].fetch_url
185
+ )
146
186
147
187
148
188
class UpdatingRemoteFixture (t .NamedTuple ):
0 commit comments