diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7f4f33d8db..6049d54019 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+## Added
+- add `trace-libgit` feature to make git tracing optional [[@dm9pZCAq](https://github.com/dm9pZCAq)] ([#902](https://github.com/extrawurst/gitui/issues/902))
+
## [0.18] - 2021-10-11
**rebase merge with conflicts**
diff --git a/Cargo.toml b/Cargo.toml
index 293d973d18..c075a4324a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,7 +20,7 @@ keywords = [
[dependencies]
scopetime = { path = "./scopetime", version = "0.1" }
-asyncgit = { path = "./asyncgit", version = "0.18" }
+asyncgit = { path = "./asyncgit", version = "0.18", default-features = false }
filetreelist = { path = "./filetreelist", version = "0.4" }
crossterm = { version = "0.20", features = [ "serde" ] }
clap = { version = "2.33", default-features = false }
@@ -64,8 +64,9 @@ pretty_assertions = "1.0"
maintenance = { status = "actively-developed" }
[features]
-default=[]
+default=["trace-libgit"]
timing=["scopetime/enabled"]
+trace-libgit=["asyncgit/trace-libgit"]
[workspace]
members=[
@@ -86,4 +87,4 @@ codegen-units = 1
opt-level = 3
[profile.dev]
-split-debuginfo = "unpacked"
\ No newline at end of file
+split-debuginfo = "unpacked"
diff --git a/README.md b/README.md
index 800630578b..2a276f367f 100644
--- a/README.md
+++ b/README.md
@@ -167,6 +167,13 @@ Binaries available for:
### Cargo Install
The simplest way to start playing around with `gitui` is to have `cargo` build and install it with `cargo install gitui`. If you are not familiar with rust and cargo: [Getting Started with Rust](https://doc.rust-lang.org/book/ch01-00-getting-started.html)
+### Cargo Features
+#### trace-libgit
+enable `libgit2` tracing
+
+works if `libgit2` builded with `-DENABLE_TRACE=ON`
+
+this feature enabled by default, to disable: `cargo install --no-default-features`
## 8. Diagnostics [Top ▲](#table-of-contents)
diff --git a/asyncgit/Cargo.toml b/asyncgit/Cargo.toml
index de0172b9cf..5574ba222d 100644
--- a/asyncgit/Cargo.toml
+++ b/asyncgit/Cargo.toml
@@ -30,4 +30,8 @@ easy-cast = "0.4"
tempfile = "3.2"
invalidstring = { path = "../invalidstring", version = "0.1" }
serial_test = "0.5.1"
-pretty_assertions = "1.0"
\ No newline at end of file
+pretty_assertions = "1.0"
+
+[features]
+default = ["trace-libgit"]
+trace-libgit = []
\ No newline at end of file
diff --git a/asyncgit/src/lib.rs b/asyncgit/src/lib.rs
index 3dffa22d05..2f3c674ff6 100644
--- a/asyncgit/src/lib.rs
+++ b/asyncgit/src/lib.rs
@@ -101,10 +101,16 @@ pub fn hash(v: &T) -> u64 {
}
///
+#[cfg(feature = "trace-libgit")]
pub fn register_tracing_logging() -> bool {
+ fn git_trace(level: git2::TraceLevel, msg: &str) {
+ log::info!("[{:?}]: {}", level, msg);
+ }
git2::trace_set(git2::TraceLevel::Trace, git_trace)
}
-fn git_trace(level: git2::TraceLevel, msg: &str) {
- log::info!("[{:?}]: {}", level, msg);
+///
+#[cfg(not(feature = "trace-libgit"))]
+pub fn register_tracing_logging() -> bool {
+ true
}