History

feat: Enable `auto-chain-error` by default.

This way, the behaviour of `gix::Error` is the same as it was before without actually exposing an `Exn` error tree.

Sebastian Thiel committed 9 months ago

Commit 08d79661 parent 00c053c3 files · +12 −3Browse files

Unified · Split

3 files
  1. .github/workflows/ci.yml +3 −1
  2. gix/Cargo.toml +8 −2
  3. justfile +1 −0
.github/workflows/ci.yml+3−1
@@ -280,8 +280,10 @@ jobs: · 279 unmodified lines
280 # due to being more in line with some Unix-oriented assumptions. So we need to verify that280 # due to being more in line with some Unix-oriented assumptions. So we need to verify that
281 # the test suite is compatible with being run even outside that environment, including that281 # the test suite is compatible with being run even outside that environment, including that
282 # `gix-testtools` is still able to run fixture scripts with the `bash` shell as intended.282 # `gix-testtools` is still able to run fixture scripts with the `bash` shell as intended.
283 # `gix-error` is excluded because it gets compiled with the wrong feature toggles here.
284 # It's tested individually.
283 run: | # zizmor: ignore[template-injection]285 run: | # zizmor: ignore[template-injection]
284 cargo nextest run --workspace --no-fail-fast -- ${{ matrix.test-args }}286 cargo nextest run --workspace --no-fail-fast --exclude gix-error -- ${{ matrix.test-args }}
285 - name: Check that tracked archives are up to date287 - name: Check that tracked archives are up to date
286 run: |288 run: |
287 # If this fails, the fix is usually to commit a regenerated archive.289 # If this fails, the fix is usually to commit a regenerated archive.
gix/Cargo.toml+8−2
@@ -24,7 +24,7 @@ required-features = ["blocking-network-client"] · 23 unmodified lines
24 24
25[features]25[features]
26 26
27default = ["max-performance-safe", "comfort", "basic", "extras"]27default = ["max-performance-safe", "comfort", "basic", "extras", "auto-chain-error"]
28 28
29#! There are various categories of features which help to optimize performance and build times. `gix` comes with 'batteries included' and everything is29#! There are various categories of features which help to optimize performance and build times. `gix` comes with 'batteries included' and everything is
30#! enabled as long as it doesn't sacrifice compatibility. Most users will be fine with that but will pay with higher compile times than necessary as they30#! enabled as long as it doesn't sacrifice compatibility. Most users will be fine with that but will pay with higher compile times than necessary as they
@@ -272,6 +272,12 @@ zlib-stock = ["gix-features/zlib"] · 241 unmodified lines
272#!272#!
273#! The catch-all of feature toggles.273#! The catch-all of feature toggles.
274 274
275## All [`gix::Error`](crate::Error) will produce error chains, which makes them work as expected in conjunction with `anyhow`.
276auto-chain-error = ["gix-error/auto-chain-error"]
277
278## The opposite of `auto-chain-error`. Use it to override `auto-chain-error`.
279tree-error = ["gix-error/tree-error"]
280
275## Enable tracing using the `tracing` crate for coarse tracing.281## Enable tracing using the `tracing` crate for coarse tracing.
276tracing = ["gix-features/tracing"]282tracing = ["gix-features/tracing"]
277 283
@@ -407,7 +413,7 @@ document-features = { version = "0.2.0", optional = true } · 129 unmodified lines
407[dev-dependencies]413[dev-dependencies]
408# For additional features that aren't enabled by default due to MSRV414# For additional features that aren't enabled by default due to MSRV
409gix = { path = ".", default-features = false, features = [415gix = { path = ".", default-features = false, features = [
410 "need-more-recent-msrv",416 "need-more-recent-msrv", "tree-error"
411] }417] }
412pretty_assertions = "1.4.0"418pretty_assertions = "1.4.0"
413gix-testtools = { path = "../tests/tools" }419gix-testtools = { path = "../tests/tools" }
justfile+1−0
@@ -158,6 +158,7 @@ unit-tests: · 157 unmodified lines
158 cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast158 cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel --no-fail-fast
159 cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast159 cargo nextest run -p gix-worktree-tests --features gix-features-parallel --no-fail-fast
160 cargo nextest run -p gix-error --no-fail-fast --test auto-chain-error --features auto-chain-error160 cargo nextest run -p gix-error --no-fail-fast --test auto-chain-error --features auto-chain-error
161 cargo nextest run -p gix-error --no-fail-fast
161 cargo nextest run -p gix-hash --no-fail-fast162 cargo nextest run -p gix-hash --no-fail-fast
162 cargo nextest run -p gix-hash --features sha256 --no-fail-fast163 cargo nextest run -p gix-hash --features sha256 --no-fail-fast
163 cargo nextest run -p gix-hash --no-default-features --features sha256 --no-fail-fast # TODO: make this actually work by removing 'sha1' from default features.164 cargo nextest run -p gix-hash --no-default-features --features sha256 --no-fail-fast # TODO: make this actually work by removing 'sha1' from default features.