v0.3.4 - Print correct main author
This change makes `get_main_author` try to fetch `user.name` and `user.email` from the current repo before falling back to a global default. Co-authored-by: Maria Hansson <mariahansson92@hotmail.com>
This commit is contained in:
parent
4575605991
commit
e60fae7031
|
|
@ -157,7 +157,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "git_mob"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"dirs",
|
||||
"git2",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "git_mob"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
authors = ["Martin Frost <martin@frost.ws>"]
|
||||
edition = "2018"
|
||||
description = "A CLI tool for social coding."
|
||||
|
|
|
|||
|
|
@ -24,7 +24,11 @@ impl fmt::Display for Author {
|
|||
}
|
||||
|
||||
pub fn get_main_author() -> Author {
|
||||
let cfg = Config::open_default().unwrap();
|
||||
let cfg = match Repository::open_from_env() {
|
||||
Ok(repo) => repo.config().unwrap(),
|
||||
Err(_e) => Config::open_default().unwrap()
|
||||
};
|
||||
|
||||
let name = cfg.get_entry("user.name").unwrap();
|
||||
let email = cfg.get_entry("user.email").unwrap();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue