cli: Fix Message::get bug

We were not propagating the error properly.
This commit is contained in:
Alexis Sellier
2023-04-27 11:22:44 +02:00
parent 44298df48f
commit 60fc50644f
5 changed files with 7 additions and 11 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ pub fn handle_patch_message(
let commit_message = head_commit
.message()
.ok_or(anyhow!("commit summary is not valid UTF-8; aborting"))?;
let message = message.get(&format!("{commit_message}{PATCH_MSG}"));
let message = message.get(&format!("{commit_message}{PATCH_MSG}"))?;
let message = message.replace(PATCH_MSG.trim(), ""); // Delete help message.
let (title, description) = message.split_once("\n\n").unwrap_or((&message, ""));
let (title, description) = (title.trim(), description.trim());
+1 -1
View File
@@ -100,7 +100,7 @@ pub fn run(
let head_oid = branch_oid(&head_branch)?;
let base_oid = workdir.merge_base(*target_oid, *head_oid)?;
let message = message.get(REVISION_MSG);
let message = message.get(REVISION_MSG)?;
let message = message.replace(REVISION_MSG.trim(), "");
let message = message.trim();
let signer = term::signer(profile)?;