@@ -131,15 +131,21 @@ mod branch_remote {
131
131
. as_ref( ) ,
132
132
"remote_repo"
133
133
) ;
134
+ assert_eq ! (
135
+ repo. branch_remote_name( "broken" , direction)
136
+ . expect( "Remote name exists" )
137
+ . as_ref( ) ,
138
+ "remote_repo"
139
+ ) ;
134
140
}
135
141
136
- let merge_branch_invalid_msg = "The configured name of the remote ref to merge wasn't valid" ;
137
142
assert_eq ! (
138
143
repo. branch_remote_ref_name( "refs/heads/broken" . try_into( ) ?, remote:: Direction :: Fetch )
139
144
. 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."
143
149
) ;
144
150
assert ! ( repo
145
151
. branch_remote_ref_name( "refs/heads/missing" . try_into( ) ?, remote:: Direction :: Fetch )
@@ -152,11 +158,11 @@ mod branch_remote {
152
158
}
153
159
assert_eq ! (
154
160
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 " ,
160
166
) ;
161
167
162
168
Ok ( ( ) )
@@ -219,10 +225,9 @@ mod branch_remote {
219
225
) ;
220
226
}
221
227
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" ,
226
231
) ;
227
232
228
233
Ok ( ( ) )
0 commit comments