mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-31 00:12:06 +00:00
cli: use placeholder name/email if not configured instead of crashing
This commit is contained in:
parent
b97d25038b
commit
31f3984728
2 changed files with 9 additions and 3 deletions
|
@ -55,13 +55,15 @@ impl UserSettings {
|
|||
}
|
||||
|
||||
pub fn user_name(&self) -> String {
|
||||
self.config.get_str("user.name").expect("no user.name set")
|
||||
self.config
|
||||
.get_str("user.name")
|
||||
.unwrap_or_else(|_| "<no name configured>".to_string())
|
||||
}
|
||||
|
||||
pub fn user_email(&self) -> String {
|
||||
self.config
|
||||
.get_str("user.email")
|
||||
.expect("no user.email set")
|
||||
.unwrap_or_else(|_| "<no email configured>".to_string())
|
||||
}
|
||||
|
||||
pub fn config(&self) -> &config::Config {
|
||||
|
|
|
@ -825,7 +825,11 @@ fn cmd_files(
|
|||
let mut repo_command = command.repo_helper(ui)?;
|
||||
let commit = repo_command.resolve_revision_arg(sub_matches)?;
|
||||
for (name, _value) in commit.tree().entries() {
|
||||
writeln!(ui, "{}", &ui.format_file_path(repo_command.repo().working_copy_path(), &name))?;
|
||||
writeln!(
|
||||
ui,
|
||||
"{}",
|
||||
&ui.format_file_path(repo_command.repo().working_copy_path(), &name)
|
||||
)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue