@@ -131,15 +131,21 @@ mod branch_remote {
131131 . as_ref( ) ,
132132 "remote_repo"
133133 ) ;
134+ assert_eq ! (
135+ repo. branch_remote_name( "broken" , direction)
136+ . expect( "Remote name exists" )
137+ . as_ref( ) ,
138+ "remote_repo"
139+ ) ;
134140 }
135141
136- let merge_branch_invalid_msg = "The configured name of the remote ref to merge wasn't valid" ;
137142 assert_eq ! (
138143 repo. branch_remote_ref_name( "refs/heads/broken" . try_into( ) ?, remote:: Direction :: Fetch )
139144 . expect( "Remote Merge ref exists" )
140- . unwrap_err( )
141- . to_string( ) ,
142- merge_branch_invalid_msg
145+ . expect( "merge ref is turned into a full-name" )
146+ . as_bstr( ) ,
147+ "refs/heads/not_a_valid_merge_ref" ,
148+ "short names are simply turned into branch names - this doesn't always work, but sometimes."
143149 ) ;
144150 assert ! ( repo
145151 . branch_remote_ref_name( "refs/heads/missing" . try_into( ) ?, remote:: Direction :: Fetch )
@@ -152,11 +158,11 @@ mod branch_remote {
152158 }
153159 assert_eq ! (
154160 repo. branch_remote_tracking_ref_name( "refs/heads/broken" . try_into( ) ?, remote:: Direction :: Fetch )
155- . expect( "err " )
156- . unwrap_err ( )
157- . to_string ( ) ,
158- "Could not get the remote reference to translate into the local tracking branch " ,
159- "the merge ref is broken, hence there can't be a tracking ref" ,
161+ . expect( "no error " )
162+ . expect ( "valid result" )
163+ . as_bstr ( ) ,
164+ "refs/remotes/remote_repo/not_a_valid_merge_ref " ,
165+ "the merge ref is broken, but we turned it into a full ref name from which everything else was derived " ,
160166 ) ;
161167
162168 Ok ( ( ) )
@@ -219,10 +225,9 @@ mod branch_remote {
219225 ) ;
220226 }
221227
222- assert_eq ! (
223- repo. branch_remote_tracking_ref_name( "refs/heads/broken" . try_into( ) ?, remote:: Direction :: Push ) . expect( "has err" ) . unwrap_err( ) . to_string( ) ,
224- "Could not get the remote reference to translate into the local tracking branch" ,
225- "push.default = simple, hence we need to verify the merge-branch is the same as us, but retrieving it fails" ,
228+ assert ! (
229+ repo. branch_remote_tracking_ref_name( "refs/heads/broken" . try_into( ) ?, remote:: Direction :: Push ) . is_none( ) ,
230+ "push.default = simple, hence we need to verify the merge-branch is the same as us, and retrieving it succeeds due to auto-fullnamification but then it doesn't match" ,
226231 ) ;
227232
228233 Ok ( ( ) )
0 commit comments