cli: Don't strip initial message from editor
This was problematic when the initial message was a valid default.
This commit is contained in:
parent
63fc06c817
commit
6c1e2d0ddd
|
|
@ -40,7 +40,7 @@ pub fn handle_patch_message(
|
||||||
let (title, description) = (title.trim(), description.trim());
|
let (title, description) = (title.trim(), description.trim());
|
||||||
|
|
||||||
if title.is_empty() {
|
if title.is_empty() {
|
||||||
anyhow::bail!("a title must be given");
|
anyhow::bail!("a patch title must be provided");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok((title.to_string(), description.to_owned()))
|
Ok((title.to_string(), description.to_owned()))
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,10 @@ impl Editor {
|
||||||
process::Command::new(cmd).arg(&self.path).spawn()?.wait()?;
|
process::Command::new(cmd).arg(&self.path).spawn()?.wait()?;
|
||||||
|
|
||||||
let text = fs::read_to_string(&self.path)?;
|
let text = fs::read_to_string(&self.path)?;
|
||||||
let text = text.strip_prefix(&initial).unwrap_or(&text);
|
|
||||||
|
|
||||||
if text.trim().is_empty() {
|
if text.trim().is_empty() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
Ok(Some(text.to_owned()))
|
Ok(Some(text))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue