Skip to content

Commit

Permalink
Update to git2-0.19
Browse files Browse the repository at this point in the history
Update the `git2` dependencies to `0.19`, which also allows the uncommenting of
two tests in the `diff` test suite -- as reported by [issue #149][#149].

[#149]: #149

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
  • Loading branch information
FintanH committed Jun 28, 2024
1 parent 0dd1383 commit 224ad08
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 50 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion git-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ thiserror = "1"
either = "1.8.0"

[dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
2 changes: 1 addition & 1 deletion git-storage/t/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proptest = "1"
path = ".."

[dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
2 changes: 1 addition & 1 deletion radicle-git-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ percent-encoding = "2"
thiserror = "1"

[dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
2 changes: 1 addition & 1 deletion radicle-git-ext/t/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ serde = "1"
serde_json = "1"

[dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
2 changes: 1 addition & 1 deletion radicle-surf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ thiserror = "1.0"
url = "2.5"

[dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
2 changes: 1 addition & 1 deletion radicle-surf/t/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ serde_json = "1"
url = "2.5"

[dev-dependencies.git2]
version = "0.18.1"
version = "0.19"
default-features = false
features = ["vendored-libgit2"]

Expand Down
78 changes: 38 additions & 40 deletions radicle-surf/t/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -630,44 +630,42 @@ index f89e4c0..7c56eb7 100644
);
}

// TODO(xphoniex): uncomment once libgit2 has fixed the bug
//#[test]
//fn test_old_missing_eof_newline() {
// let buf = r#"
//diff --git a/.env b/.env
//index f89e4c0..7c56eb7 100644
//--- a/.env
//+++ b/.env
//@@ -1 +1 @@
//-hello=123
//\ No newline at end of file
//+hello=1234
//"#;
// let diff = git2::Diff::from_buffer(buf.as_bytes()).unwrap();
// let diff = Diff::try_from(diff).unwrap();
// assert_eq!(
// diff.modified().next().unwrap().diff.eof(),
// Some(EofNewLine::OldMissing)
// );
//}
#[test]
fn test_old_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
--- a/.env
+++ b/.env
@@ -1 +1 @@
-hello=123
\ No newline at end of file
+hello=1234
"#;
let diff = git2::Diff::from_buffer(buf.as_bytes()).unwrap();
let diff = Diff::try_from(diff).unwrap();
assert_eq!(
diff.modified().next().unwrap().diff.eof(),
Some(EofNewLine::OldMissing)
);
}

// TODO(xphoniex): uncomment once libgit2 has fixed the bug
//#[test]
//fn test_new_missing_eof_newline() {
// let buf = r#"
//diff --git a/.env b/.env
//index f89e4c0..7c56eb7 100644
//--- a/.env
//+++ b/.env
//@@ -1 +1 @@
//-hello=123
//+hello=1234
//\ No newline at end of file
//"#;
// let diff = git2::Diff::from_buffer(buf.as_bytes()).unwrap();
// let diff = Diff::try_from(diff).unwrap();
// assert_eq!(
// diff.modified().next().unwrap().diff.eof(),
// Some(EofNewLine::NewMissing)
// );
//}
#[test]
fn test_new_missing_eof_newline() {
let buf = r#"
diff --git a/.env b/.env
index f89e4c0..7c56eb7 100644
--- a/.env
+++ b/.env
@@ -1 +1 @@
-hello=123
+hello=1234
\ No newline at end of file
"#;
let diff = git2::Diff::from_buffer(buf.as_bytes()).unwrap();
let diff = Diff::try_from(diff).unwrap();
assert_eq!(
diff.modified().next().unwrap().diff.eof(),
Some(EofNewLine::NewMissing)
);
}

0 comments on commit 224ad08

Please sign in to comment.