diff --git a/rust/rhg/src/commands/config.rs b/rust/rhg/src/commands/config.rs --- a/rust/rhg/src/commands/config.rs +++ b/rust/rhg/src/commands/config.rs @@ -29,8 +29,10 @@ pub fn run(invocation: &crate::CliInvoca .split_2(b'.') .ok_or_else(|| HgError::unsupported("hg config
"))?; - let value = invocation.config.get(section, name).unwrap_or(b""); - - invocation.ui.write_stdout(&format_bytes!(b"{}\n", value))?; - Ok(()) + if let Some(value) = invocation.config.get(section, name) { + invocation.ui.write_stdout(&format_bytes!(b"{}\n", value))?; + Ok(()) + } else { + Err(CommandError::Unsuccessful) + } }