History

Break cyclical dev dependencies

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.

Pascal Kuthe committed 3 years ago

Commit 1fea18f1 parent cec254792 files · +1036 −321Browse files

Showing the changes to git-diff (4 of 92 files). Show all

Unified · Split

4 files
  1. git-diff/Cargo.toml +1 −5
  2. git-diff/tests/Cargo.toml +26 −0
  3. git-diff/tests/diff.rs +3 −1
  4. git-diff/tests/tree/mod.rs +1 −1
git-diff/Cargo.toml+1−5
@@ -8,6 +8,7 @@ authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"] · 7 unmodified lines
8edition = "2021"8edition = "2021"
9include = ["src/**/*"]9include = ["src/**/*"]
10rust-version = "1.64"10rust-version = "1.64"
11autotests = false
11 12
12[features]13[features]
13serde1 = ["serde", "git-hash/serde1", "git-object/serde1"]14serde1 = ["serde", "git-hash/serde1", "git-object/serde1"]
@@ -21,8 +22,3 @@ git-object = { version = "^0.26.0", path = "../git-object" } · 7 unmodified lines
21thiserror = "1.0.32"22thiserror = "1.0.32"
22imara-diff = "0.1.3"23imara-diff = "0.1.3"
23serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}24serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
24
25[dev-dependencies]
26git-odb = { path = "../git-odb" }
27git-traverse = { path = "../git-traverse" }
28git-testtools = { path = "../tests/tools" }
git-diff/tests/Cargo.toml+26−0
@@ -0,0 +1,26 @@
1[package]
2name = "git-diff-test"
3version = "0.0.0"
4publish = false
5repository = "https://github.com/Byron/gitoxide"
6license = "MIT/Apache-2.0"
7description = "Calculate differences between various git objects"
8authors = ["Sebastian Thiel <sebastian.thiel@icloud.com>"]
9edition = "2021"
10include = ["src/**/*"]
11rust-version = "1.64"
12
13[features]
14serde1 = ["git-diff/serde", "git-hash/serde1", "git-object/serde1"]
15
16[[test]]
17name = "diff"
18path = "diff.rs"
19
20[dev-dependencies]
21git-diff = { path = ".." }
22git-hash = { path = "../../git-hash" }
23git-object = { path = "../../git-object" }
24git-odb = { path = "../../git-odb" }
25git-traverse = { path = "../../git-traverse" }
26git-testtools = { path = "../../tests/tools" }
git-diff/tests/diff.rs+3−1
@@ -1,6 +1,8 @@
1pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;1pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
2 2
3pub use git_testtools::hex_to_id;3fn hex_to_id(hex: &str) -> git_hash::ObjectId {
4 git_hash::ObjectId::from_hex(hex.as_bytes()).expect("40 bytes hex")
5}
4 6
5mod blob;7mod blob;
6mod tree;8mod tree;
git-diff/tests/tree/mod.rs+1−1
@@ -11,7 +11,7 @@ mod changes { · 10 unmodified lines
11 11
12 fn db(args: impl IntoIterator<Item = &'static str>) -> crate::Result<git_odb::Handle> {12 fn db(args: impl IntoIterator<Item = &'static str>) -> crate::Result<git_odb::Handle> {
13 git_odb::at(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 .join(".git")15 .join(".git")
16 .join("objects"),16 .join("objects"),
17 )17 )

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t