mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-04 18:19:27 +00:00
fix init --title option failure when git user is not configured
This commit is contained in:
parent
0c580c32c4
commit
8f024dabc3
2 changed files with 2 additions and 2 deletions
|
@ -74,9 +74,9 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
|
||||||
if let Some(author) = get_author_name() {
|
if let Some(author) = get_author_name() {
|
||||||
debug!("Obtained user name from gitconfig: {:?}", author);
|
debug!("Obtained user name from gitconfig: {:?}", author);
|
||||||
config.book.authors.push(author);
|
config.book.authors.push(author);
|
||||||
builder.with_config(config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
builder.with_config(config);
|
||||||
builder.build()?;
|
builder.build()?;
|
||||||
println!("\nAll done, no errors...");
|
println!("\nAll done, no errors...");
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,5 @@ fn no_git_config_with_title() {
|
||||||
.stdout(predicates::str::contains("\nAll done, no errors...\n"));
|
.stdout(predicates::str::contains("\nAll done, no errors...\n"));
|
||||||
|
|
||||||
let config = Config::from_disk(temp.path().join("book.toml")).unwrap();
|
let config = Config::from_disk(temp.path().join("book.toml")).unwrap();
|
||||||
assert_eq!(config.book.title, None);
|
assert_eq!(config.book.title.as_deref(), Some("Example title"));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue