hook into libgit2 tracing (#822)

This commit is contained in:
Stephan Dilly 2021-08-15 14:24:20 +02:00 committed by GitHub
parent 71b398e858
commit e16dfcaee7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View file

@ -14,10 +14,10 @@ keywords = ["git"]
[dependencies]
scopetime = { path = "../scopetime", version = "0.1" }
git2 = "0.13"
# git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]}
# git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="fc13dcc", features = ["vendored-openssl"]}
# pinning to vendored openssl, using the git2 feature this gets lost with new resolver
openssl-sys = { version = '0.9', features= ["vendored"] }
# git2 = { path = "../../github/git2-rs", features = ["vendored-openssl"]}
# git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="513a8c9", features = ["vendored-openssl"]}
rayon-core = "1.9"
crossbeam-channel = "0.5"
log = "0.4"

View file

@ -94,3 +94,12 @@ pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
v.hash(&mut hasher);
hasher.finish()
}
///
pub fn register_tracing_logging() -> bool {
git2::trace_set(git2::TraceLevel::Trace, git_trace)
}
fn git_trace(level: git2::TraceLevel, msg: &str) {
log::info!("[{:?}]: {}", level, msg);
}

View file

@ -97,6 +97,8 @@ fn main() -> Result<()> {
let _profiler = Profiler::new();
asyncgit::register_tracing_logging();
if !valid_path()? {
eprintln!("invalid path\nplease run gitui inside of a non-bare git repository");
return Ok(());