File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -284,13 +284,14 @@ pub fn git_repo_base_ref(repo: &git2::Repository, remote_name: &str) -> Result<S
284284 . to_owned ( ) ;
285285
286286 let expected_prefix = format ! ( "{remote_name}/" ) ;
287- if let Some ( branch_name) = name. strip_prefix ( & expected_prefix) {
288- Ok ( branch_name. to_owned ( ) )
289- } else {
290- Err ( anyhow:: anyhow!(
291- "Remote branch name '{name}' does not start with expected prefix '{expected_prefix}'"
292- ) )
293- }
287+ name. strip_prefix ( & expected_prefix)
288+ . map ( |s| s. to_owned ( ) )
289+ . ok_or_else ( || {
290+ anyhow:: anyhow!(
291+ "Remote branch name '{name}' does not start with expected prefix \
292+ '{expected_prefix}'"
293+ )
294+ } )
294295}
295296
296297/// Like git_repo_base_repo_name but preserves the original case of the repository name.
You can’t perform that action at this time.
0 commit comments