This commit breaks cyclical dev-dependencies. These cause problems with rust analyzer which makes gitoxide development with RA basically impossible. git-testools is mostly used as a utility we can simply use the crates.io version of the respective gitoxide crates to circumvent that problem. However, most other crates require matching crate versions. Here the integration tests were simply moved to a subcrate in the same folder by adding a Cargo.toml file in the tests folder. The hex_to_id function in git-testtools is a specical case because that function returns a git_hash::ObjectId instance. This ObjectId would belong to the crates.io version of git-hash and can not be used in tests. To work around that hex_to_id is moved into the individual tests as it's a very small one-line function.
Showing the changes to git-diff (4 of 92 files). Show all
Unified · Split
| @@ -8,6 +8,7 @@ authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] · 7 unmodified lines | ||
| 8 | 8 | edition = "2021" |
| 9 | 9 | include = ["src/**/*"] |
| 10 | 10 | rust-version = "1.64" |
| 11 | +autotests = false | |
| 11 | 12 | |
| 12 | 13 | [features] |
| 13 | 14 | serde1 = ["serde", "git-hash/serde1", "git-object/serde1"] |
| @@ -21,8 +22,3 @@ git-object = { version = "^0.26.0", path = "../git-object" } · 7 unmodified lines | ||
| 21 | 22 | thiserror = "1.0.32" |
| 22 | 23 | imara-diff = "0.1.3" |
| 23 | 24 | serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]} |
| 24 | − | |
| 25 | −[dev-dependencies] | |
| 26 | −git-odb = { path = "../git-odb" } | |
| 27 | −git-traverse = { path = "../git-traverse" } | |
| 28 | −git-testtools = { path = "../tests/tools" } | |
| @@ -0,0 +1,26 @@ | ||
| 1 | +[package] | |
| 2 | +name = "git-diff-test" | |
| 3 | +version = "0.0.0" | |
| 4 | +publish = false | |
| 5 | +repository = "https://github.com/Byron/gitoxide" | |
| 6 | +license = "MIT/Apache-2.0" | |
| 7 | +description = "Calculate differences between various git objects" | |
| 8 | +authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] | |
| 9 | +edition = "2021" | |
| 10 | +include = ["src/**/*"] | |
| 11 | +rust-version = "1.64" | |
| 12 | + | |
| 13 | +[features] | |
| 14 | +serde1 = ["git-diff/serde", "git-hash/serde1", "git-object/serde1"] | |
| 15 | + | |
| 16 | +[[test]] | |
| 17 | +name = "diff" | |
| 18 | +path = "diff.rs" | |
| 19 | + | |
| 20 | +[dev-dependencies] | |
| 21 | +git-diff = { path = ".." } | |
| 22 | +git-hash = { path = "../../git-hash" } | |
| 23 | +git-object = { path = "../../git-object" } | |
| 24 | +git-odb = { path = "../../git-odb" } | |
| 25 | +git-traverse = { path = "../../git-traverse" } | |
| 26 | +git-testtools = { path = "../../tests/tools" } | |
| @@ -1,6 +1,8 @@ | ||
| 1 | 1 | pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>; |
| 2 | 2 | |
| 3 | −pub use git_testtools::hex_to_id; | |
| 3 | +fn hex_to_id(hex: &str) -> git_hash::ObjectId { | |
| 4 | + git_hash::ObjectId::from_hex(hex.as_bytes()).expect("40 bytes hex") | |
| 5 | +} | |
| 4 | 6 | |
| 5 | 7 | mod blob; |
| 6 | 8 | mod tree; |
| @@ -11,7 +11,7 @@ mod changes { · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | fn db(args: impl IntoIterator<Item = &'static str>) -> crate::Result<git_odb::Handle> { |
| 13 | 13 | git_odb::at( |
| 14 | − git_testtools::scripted_fixture_read_only_with_args("make_diff_repo.sh", args)? | |
| 14 | + git_testtools::scripted_fixture_read_only_with_args_standalone("make_diff_repo.sh", args)? | |
| 15 | 15 | .join(".git") |
| 16 | 16 | .join("objects"), |
| 17 | 17 | ) |