Skip to content

Commit 8f024da

Browse files
eureka-cpuehuss
authored andcommitted
fix init --title option failure when git user is not configured
1 parent 0c580c3 commit 8f024da

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/cmd/init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ pub fn execute(args: &ArgMatches) -> Result<()> {
7474
if let Some(author) = get_author_name() {
7575
debug!("Obtained user name from gitconfig: {:?}", author);
7676
config.book.authors.push(author);
77-
builder.with_config(config);
7877
}
7978

79+
builder.with_config(config);
8080
builder.build()?;
8181
println!("\nAll done, no errors...");
8282

tests/cli/init.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ fn no_git_config_with_title() {
4343
.stdout(predicates::str::contains("\nAll done, no errors...\n"));
4444

4545
let config = Config::from_disk(temp.path().join("book.toml")).unwrap();
46-
assert_eq!(config.book.title, None);
46+
assert_eq!(config.book.title.as_deref(), Some("Example title"));
4747
}

0 commit comments

Comments
 (0)