Skip to content

Commit 4d2d433

Browse files
committed
refactor!: Remove light* features, add 'lean-async' in its place; remove termion support (#215)
1 parent 2abba9c commit 4d2d433

27 files changed

+212
-96
lines changed

Diff for: Cargo.toml

+11-10
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ doctest = false
2727
[features]
2828
default = ["max"]
2929

30-
max = ["fast", "pretty-cli", "prodash/render-tui-crossterm", "prodash-render-line-crossterm", "prodash/render-line-autoconfigure", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client"]
30+
max = ["fast", "pretty-cli", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client",
31+
"prodash-render-line", "prodash-render-tui",
32+
"prodash/render-line-autoconfigure" ]
3133

32-
lean = ["fast", "pretty-cli", "prodash-render-line-crossterm", "prodash/progress-tree", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client"]
33-
lean-async = ["fast", "pretty-cli", "prodash-render-line-crossterm", "prodash/progress-tree", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-async-client"]
34+
lean = ["fast", "pretty-cli", "http-client-curl", "gitoxide-core-tools", "gitoxide-core-blocking-client",
35+
"prodash-render-line" ]
36+
lean-async = ["fast", "pretty-cli", "gitoxide-core-tools", "gitoxide-core-async-client",
37+
"prodash-render-line"]
3438

35-
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend"]
39+
small = ["pretty-cli", "git-features/rustsha1", "git-features/zlib-rust-backend", "prodash/progress-log", "atty"]
3640

3741
gitoxide-core-tools = ["gitoxide-core/organize", "gitoxide-core/estimate-hours"]
3842
gitoxide-core-blocking-client = ["gitoxide-core/blocking-client"]
@@ -45,17 +49,14 @@ pretty-cli = ["clap",
4549
"prodash/progress-tree",
4650
"prodash/progress-tree-log",
4751
"prodash/local-time",
48-
"prodash-render-tui",
49-
"prodash-render-line",
5052
"gitoxide-core/local-time-support",
51-
"env_logger",
52-
"futures-lite"]
53+
"env_logger" ]
5354

5455
prodash-render-line-crossterm = ["prodash-render-line", "prodash/render-line-crossterm", "atty", "crosstermion"]
5556

5657
# internal
57-
prodash-render-tui = ["prodash/render-tui"]
58-
prodash-render-line = ["prodash/render-line"]
58+
prodash-render-tui = ["prodash/render-tui", "prodash/render-tui-crossterm", "prodash/progress-tree", "futures-lite"]
59+
prodash-render-line = ["prodash/render-line", "prodash-render-line-crossterm", "prodash/progress-tree"]
5960
cache-efficiency-debug = ["git-features/cache-efficiency-debug"]
6061

6162
[dependencies]

Diff for: Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ doc: ## Run cargo doc on all crates
6262
clippy: ## Run cargo clippy on all crates
6363
cargo clippy --all --tests
6464
cargo clippy --all --no-default-features --features small
65-
cargo clippy --all --no-default-features --features light-async --tests
65+
cargo clippy --all --no-default-features --features lean-async --tests
6666

6767
check: ## Build all code in suitable configurations
6868
cargo check --all
@@ -156,17 +156,17 @@ jtt = target/debug/jtt
156156
journey-tests: always ## run journey tests (max)
157157
cargo build
158158
cargo build --package git-testtools --bin jtt
159-
./tests/journey.sh target/debug/gix target/debug/gix $(jtt) max
159+
./tests/journey.sh target/debug/ein target/debug/gix $(jtt) max
160160

161161
journey-tests-small: always ## run journey tests (lean-cli)
162162
cargo build --no-default-features --features small
163163
cd tests/tools && cargo build
164-
./tests/journey.sh target/debug/gix target/debug/gix $(jtt) small
164+
./tests/journey.sh target/debug/ein target/debug/gix $(jtt) small
165165

166-
journey-tests-async: always ## run journey tests (light-async)
167-
cargo build --no-default-features --features light-async
166+
journey-tests-async: always ## run journey tests (lean-async)
167+
cargo build --no-default-features --features lean-async
168168
cd tests/tools && cargo build
169-
./tests/journey.sh target/debug/gix target/debug/gix $(jtt) async
169+
./tests/journey.sh target/debug/ein target/debug/gix $(jtt) async
170170

171171
journey-tests-smart-release:
172172
cargo build --package cargo-smart-release

Diff for: cargo-features.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ There are **convenience features**, which combine common choices of the above in
4545
* Due to async client-networking not being implemented for most transports, this one supports only the 'git' transport. It uses, however, a fully asynchronous
4646
networking implementation which can serve a real-world example on how to implement custom async transports.
4747
* **small**
48-
* As small as it can possibly be, no threading, no fast sha1, log based progress only, no cleanup of temporary files on interrupt, rust based zlib implementation.
48+
* As small as it can possibly be, no threading, no fast sha1, log based progress only, rust based zlib implementation.
4949
* no networking, local operations only.
5050

5151
### gitoxide-core

Diff for: gitoxide-core/src/remote.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub mod refs {
9797
#[cfg(feature = "serde1")]
9898
OutputFormat::Json => serde_json::to_writer_pretty(
9999
ctx.out,
100-
&delegate.refs.into_iter().map(JsonRef::from).collect::<Vec<_>>(),
100+
&delegate.refs.into_iter().map(super::JsonRef::from).collect::<Vec<_>>(),
101101
)?,
102102
}
103103
Ok(())

Diff for: src/plumbing/pretty/main.rs

+19-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,25 @@ use crate::{
1818
};
1919

2020
pub fn main() -> Result<()> {
21-
let Args {
22-
threads: thread_limit,
23-
verbose,
24-
progress,
25-
progress_keep_open,
26-
format,
27-
cmd,
28-
} = Args::parse();
21+
let args: Args = Args::parse();
22+
let thread_limit = args.threads;
23+
let verbose = args.verbose;
24+
let format = args.format;
25+
let cmd = args.cmd;
26+
27+
let progress;
28+
let progress_keep_open;
29+
#[cfg(feature = "prodash-render-tui")]
30+
{
31+
progress = args.progress;
32+
progress_keep_open = args.progress_keep_open;
33+
}
34+
#[cfg(not(feature = "prodash-render-tui"))]
35+
{
36+
progress = false;
37+
progress_keep_open = false;
38+
}
39+
2940
let should_interrupt = Arc::new(AtomicBool::new(false));
3041
git_repository::interrupt::init_handler({
3142
let should_interrupt = Arc::clone(&should_interrupt);

Diff for: src/plumbing/pretty/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ pub struct Args {
1818
pub verbose: bool,
1919

2020
/// Bring up a terminal user interface displaying progress visually
21+
#[cfg(feature = "prodash-render-tui")]
2122
#[clap(long, conflicts_with("verbose"))]
2223
pub progress: bool,
2324

2425
/// The progress TUI will stay up even though the work is already completed.
2526
///
2627
/// Use this to be able to read progress messages or additional information visible in the TUI log pane.
28+
#[cfg(feature = "prodash-render-tui")]
2729
#[clap(long, conflicts_with("verbose"), requires("progress"))]
2830
pub progress_keep_open: bool,
2931

Diff for: src/porcelain/main.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ use std::sync::{
55

66
use anyhow::Result;
77
use clap::Parser;
8-
use git_features::progress::DoOrDiscard;
98
use gitoxide_core as core;
109

11-
use crate::{
12-
porcelain::options::{Args, EstimateHours, Subcommands, ToolCommands},
13-
shared::pretty::prepare_and_run,
14-
};
10+
use crate::{porcelain::options::Args, porcelain::options::Subcommands, shared::pretty::prepare_and_run};
1511

1612
pub fn main() -> Result<()> {
1713
let args: Args = Args::parse();
@@ -35,8 +31,9 @@ pub fn main() -> Result<()> {
3531
move |_progress, _out, _err| panic!("something went very wrong"),
3632
),
3733
Subcommands::Init { directory } => core::repository::init(directory).map(|_| ()),
34+
#[cfg(feature = "gitoxide-core-tools")]
3835
Subcommands::Tools(tool) => match tool {
39-
ToolCommands::EstimateHours(EstimateHours {
36+
crate::porcelain::options::ToolCommands::EstimateHours(crate::porcelain::options::EstimateHours {
4037
working_dir,
4138
refname,
4239
show_pii,
@@ -53,7 +50,7 @@ pub fn main() -> Result<()> {
5350
hours::estimate(
5451
&working_dir,
5552
&refname,
56-
DoOrDiscard::from(progress),
53+
git_features::progress::DoOrDiscard::from(progress),
5754
hours::Context {
5855
show_pii,
5956
omit_unify_identities,
@@ -63,7 +60,7 @@ pub fn main() -> Result<()> {
6360
},
6461
)
6562
}
66-
ToolCommands::Find { root } => {
63+
crate::porcelain::options::ToolCommands::Find { root } => {
6764
use gitoxide_core::organize;
6865
prepare_and_run(
6966
"find",
@@ -75,12 +72,12 @@ pub fn main() -> Result<()> {
7572
organize::discover(
7673
root.unwrap_or_else(|| [std::path::Component::CurDir].iter().collect()),
7774
out,
78-
DoOrDiscard::from(progress),
75+
git_features::progress::DoOrDiscard::from(progress),
7976
)
8077
},
8178
)
8279
}
83-
ToolCommands::Organize {
80+
crate::porcelain::options::ToolCommands::Organize {
8481
destination_directory,
8582
execute,
8683
repository_source,
@@ -101,7 +98,7 @@ pub fn main() -> Result<()> {
10198
},
10299
repository_source.unwrap_or_else(|| [std::path::Component::CurDir].iter().collect()),
103100
destination_directory.unwrap_or_else(|| [std::path::Component::CurDir].iter().collect()),
104-
DoOrDiscard::from(progress),
101+
git_features::progress::DoOrDiscard::from(progress),
105102
)
106103
},
107104
)

Diff for: src/porcelain/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ pub enum Subcommands {
3535
/// Defaults to the current working directory.
3636
directory: Option<PathBuf>,
3737
},
38+
#[cfg(feature = "gitoxide-core-tools")]
3839
/// A selection of useful tools
3940
#[clap(subcommand)]
4041
Tools(ToolCommands),
4142
#[cfg(debug_assertions)]
4243
Panic,
4344
}
4445

46+
#[cfg(feature = "gitoxide-core-tools")]
4547
#[derive(Debug, clap::Parser)]
4648
#[clap(setting = AppSettings::DisableVersionFlag, setting = AppSettings::SubcommandRequired)]
4749
#[clap(visible_alias = "t")]

0 commit comments

Comments
 (0)