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
88 edition = "2021"
99 include = ["src/**/*"]
1010 rust-version = "1.64"
11+autotests = false
1112
1213 [features]
1314 serde1 = ["serde", "git-hash/serde1", "git-object/serde1"]
@@ -21,8 +22,3 @@ git-object = { version = "^0.26.0", path = "../git-object" } · 7 unmodified lines
2122 thiserror = "1.0.32"
2223 imara-diff = "0.1.3"
2324 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" }
git-diff/tests/Cargo.toml+26−0
@@ -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" }
git-diff/tests/diff.rs+3−1
@@ -1,6 +1,8 @@
11 pub type Result<T = ()> = std::result::Result<T, Box<dyn std::error::Error>>;
22
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+}
46
57 mod blob;
68 mod tree;
git-diff/tests/tree/mod.rs+1−1
@@ -11,7 +11,7 @@ mod changes { · 10 unmodified lines
1111
1212 fn db(args: impl IntoIterator<Item = &'static str>) -> crate::Result<git_odb::Handle> {
1313 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)?
1515 .join(".git")
1616 .join("objects"),
1717 )

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