Skip to content

add trace-libgit feature #905

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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=[
Expand All @@ -86,4 +87,4 @@ codegen-units = 1
opt-level = 3

[profile.dev]
split-debuginfo = "unpacked"
split-debuginfo = "unpacked"
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
6 changes: 5 additions & 1 deletion asyncgit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
10 changes: 8 additions & 2 deletions asyncgit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}