fix(git_state): remove unwrap in describe_rebase (#1761)

This commit is contained in:
David Knaack 2020-10-14 18:13:08 +02:00 committed by GitHub
parent a73d7140eb
commit 205fd1abdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -135,18 +135,17 @@ fn describe_rebase<'a>(root: &'a PathBuf, rebase_config: &'a str) -> StateDescri
let progress = if has_path("rebase-merge/msgnum") { let progress = if has_path("rebase-merge/msgnum") {
paths_to_progress("rebase-merge/msgnum", "rebase-merge/end") paths_to_progress("rebase-merge/msgnum", "rebase-merge/end")
} else if has_path("rebase-merge/onto") {
Some((1, 1))
} else if has_path("rebase-apply") { } else if has_path("rebase-apply") {
paths_to_progress("rebase-apply/next", "rebase-apply/last") paths_to_progress("rebase-apply/next", "rebase-apply/last")
} else { } else {
None None
}; };
let progress = progress.unwrap_or((1, 1));
StateDescription { StateDescription {
label: rebase_config, label: rebase_config,
current: Some(format!("{}", progress.unwrap().0)), current: Some(format!("{}", progress.0)),
total: Some(format!("{}", progress.unwrap().1)), total: Some(format!("{}", progress.1)),
} }
} }