add trace-libgit feature (#905)

This commit is contained in:
dm9pZCAq 2021-10-13 13:32:17 +00:00 committed by GitHub
parent d6a2af89ee
commit 31f677187b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 6 deletions

View file

@ -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**

View file

@ -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"
split-debuginfo = "unpacked"

View file

@ -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. <a name="diagnostics"></a> Diagnostics <small><sup>[Top ▲](#table-of-contents)</sup></small>

View file

@ -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"
pretty_assertions = "1.0"
[features]
default = ["trace-libgit"]
trace-libgit = []

View file

@ -101,10 +101,16 @@ pub fn hash<T: Hash + ?Sized>(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
}