File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
asyncgit/src/sync/remotes Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -186,4 +186,42 @@ mod tests {
186
186
. unwrap ( ) ;
187
187
assert_eq ! ( first, String :: from( "origin" ) ) ;
188
188
}
189
+
190
+ #[ test]
191
+ fn test_default_remote_inconclusive ( ) {
192
+ let td = TempDir :: new ( ) . unwrap ( ) ;
193
+
194
+ debug_cmd_print (
195
+ td. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) ,
196
+ "git clone https://github.com/extrawurst/brewdump.git" ,
197
+ ) ;
198
+
199
+ debug_cmd_print (
200
+ td. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) ,
201
+ "cd brewdump && git remote rename origin alternate" ,
202
+ ) ;
203
+
204
+ debug_cmd_print (
205
+ td. path ( ) . as_os_str ( ) . to_str ( ) . unwrap ( ) ,
206
+ "cd brewdump && git remote add someremote https://github.com/extrawurst/brewdump.git" ,
207
+ ) ;
208
+
209
+ let repo_path = td. path ( ) . join ( "brewdump" ) ;
210
+ let repo_path = repo_path. as_os_str ( ) . to_str ( ) . unwrap ( ) ;
211
+
212
+ let remotes = get_remotes ( repo_path) . unwrap ( ) ;
213
+ assert_eq ! (
214
+ remotes,
215
+ vec![
216
+ String :: from( "alternate" ) ,
217
+ String :: from( "someremote" )
218
+ ]
219
+ ) ;
220
+
221
+ let res = get_default_remote_in_repo (
222
+ & utils:: repo ( repo_path) . unwrap ( ) ,
223
+ ) ;
224
+ assert_eq ! ( res. is_err( ) , true ) ;
225
+ assert ! ( matches!( res, Err ( Error :: NoDefaultRemoteFound ) ) ) ;
226
+ }
189
227
}
You can’t perform that action at this time.
0 commit comments