Skip to content

Commit e16dfca

Browse files
author
Stephan Dilly
authored
hook into libgit2 tracing (#822)
1 parent 71b398e commit e16dfca

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

asyncgit/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ keywords = ["git"]
1414
[dependencies]
1515
scopetime = { path = "../scopetime", version = "0.1" }
1616
git2 = "0.13"
17+
# git2 = { path = "../../extern/git2-rs", features = ["vendored-openssl"]}
18+
# git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="fc13dcc", features = ["vendored-openssl"]}
1719
# pinning to vendored openssl, using the git2 feature this gets lost with new resolver
1820
openssl-sys = { version = '0.9', features= ["vendored"] }
19-
# git2 = { path = "../../github/git2-rs", features = ["vendored-openssl"]}
20-
# git2 = { git="https://github.com/extrawurst/git2-rs.git", rev="513a8c9", features = ["vendored-openssl"]}
2121
rayon-core = "1.9"
2222
crossbeam-channel = "0.5"
2323
log = "0.4"

asyncgit/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,12 @@ pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
9494
v.hash(&mut hasher);
9595
hasher.finish()
9696
}
97+
98+
///
99+
pub fn register_tracing_logging() -> bool {
100+
git2::trace_set(git2::TraceLevel::Trace, git_trace)
101+
}
102+
103+
fn git_trace(level: git2::TraceLevel, msg: &str) {
104+
log::info!("[{:?}]: {}", level, msg);
105+
}

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ fn main() -> Result<()> {
9797

9898
let _profiler = Profiler::new();
9999

100+
asyncgit::register_tracing_logging();
101+
100102
if !valid_path()? {
101103
eprintln!("invalid path\nplease run gitui inside of a non-bare git repository");
102104
return Ok(());

0 commit comments

Comments
 (0)