Skip to content

Commit

Permalink
add feature toggles to gitoxide (CLI) itself
Browse files Browse the repository at this point in the history
This allows to go for minimal size or for maximum performance.
  • Loading branch information
Byron committed Jun 30, 2020
1 parent dfe9b20 commit 4e50e5e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ path="src/main.rs"
test = false
doctest = false

[features]
default = ["fast"]
fast = ["git-features/parallel", "git-features/fast-sha1"]

[dependencies]
gitoxide-core = { version = "0.1.0", path = "gitoxide-core" }
git-features = { version = "0.1.0", path = "git-features", features = ["parallel", "fast-sha1"] }
git-features = { version = "0.1.0", path = "git-features" }
anyhow = "1.0.31"
structopt = "0.3.14"

Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ tests: check unit-tests journey-tests ## run all tests, including journey tests

check: ## Build all code in suitable configurations
cargo check --all
cd git-odb && cargo check --no-default-features --features fast-sha1 \
&& cargo check --no-default-features \
&& cargo check --all-features
cd git-features && && cargo check --all-features \
cd git-features && cargo check --all-features \
&& cargo check --features parallel \
&& cargo check --features fast-sha1

Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,22 @@ Provide a CLI to for the most basic user journey:
* [ ] add a remote
* [ ] push

### `git-features` guide
## Cargo features guide

Cargo uses feature toggles to control which dependencies are pulled in, allowing users to specialize crates to fit their usage.
Ideally, these should be additive.
This guide documents which features are available for each of the crates provided here and how they function.

### gitoxide

The top-level command-line interface.

* **fast** (default)
* Makes the crate execute as fast as possible by supporting parallel computation of otherwise long-running functions
as well as fast, hardware accelerated hashing.
* If disabled, the binary will be visibly smaller.

### git-features

A crate to help controlling which capabilities are available from the top-level crate that uses `gitoxide`.
All feature toggles are additive.
Expand Down

0 comments on commit 4e50e5e

Please sign in to comment.