From e16dfcaee771c65a779c151cf843b53afe9fb5fb Mon Sep 17 00:00:00 2001 From: Stephan Dilly Date: Sun, 15 Aug 2021 14:24:20 +0200 Subject: [PATCH] hook into libgit2 tracing (#822) --- asyncgit/Cargo.toml | 4 ++-- asyncgit/src/lib.rs | 9 +++++++++ src/main.rs | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/asyncgit/Cargo.toml b/asyncgit/Cargo.toml index a4549094..59f2d2c0 100644 --- a/asyncgit/Cargo.toml +++ b/asyncgit/Cargo.toml @@ -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" diff --git a/asyncgit/src/lib.rs b/asyncgit/src/lib.rs index 0768bc1c..64b92778 100644 --- a/asyncgit/src/lib.rs +++ b/asyncgit/src/lib.rs @@ -94,3 +94,12 @@ pub fn hash(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); +} diff --git a/src/main.rs b/src/main.rs index e68013da..ac17bfbd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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(());