mirror of
https://github.com/qwjyh/xdbm
synced 2025-02-23 19:47:06 +09:00
fix: getting gitconfig now respects local config
This commit is contained in:
parent
5eee4ef117
commit
8c1abbd563
1 changed files with 1 additions and 17 deletions
18
src/main.rs
18
src/main.rs
|
@ -156,23 +156,7 @@ fn add_and_commit(repo: &Repository, path: &Path, message: &str) -> Result<Oid,
|
||||||
index.write()?;
|
index.write()?;
|
||||||
let oid = index.write_tree()?;
|
let oid = index.write_tree()?;
|
||||||
let tree = repo.find_tree(oid)?;
|
let tree = repo.find_tree(oid)?;
|
||||||
let config = {
|
let config = repo.config()?;
|
||||||
let mut config = git2::Config::open_default()?;
|
|
||||||
if log::log_enabled!(log::Level::Trace) {
|
|
||||||
trace!("before reading local config");
|
|
||||||
config
|
|
||||||
.entries(None)?
|
|
||||||
.for_each(|entry| trace!("{:?} = {:?}", entry.name(), entry.value()))?;
|
|
||||||
}
|
|
||||||
config.add_file(&path.join(".git/config"), git2::ConfigLevel::Local, false)?;
|
|
||||||
if log::log_enabled!(log::Level::Trace) {
|
|
||||||
trace!("after reading local config");
|
|
||||||
config
|
|
||||||
.entries(None)?
|
|
||||||
.for_each(|entry| trace!("{:?} = {:?}", entry.name(), entry.value()))?;
|
|
||||||
}
|
|
||||||
config
|
|
||||||
};
|
|
||||||
let signature = git2::Signature::now(
|
let signature = git2::Signature::now(
|
||||||
config.get_entry("user.name")?.value().unwrap(),
|
config.get_entry("user.name")?.value().unwrap(),
|
||||||
config.get_entry("user.email")?.value().unwrap(),
|
config.get_entry("user.email")?.value().unwrap(),
|
||||||
|
|
Loading…
Reference in a new issue