From 224ad083669dcf4ab2f19813c79340b6ea58ca4c Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Fri, 28 Jun 2024 12:08:44 +0100 Subject: [PATCH] Update to git2-0.19 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]: https://github.com/radicle-dev/radicle-git/issues/149 Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- Cargo.lock | 8 ++-- git-storage/Cargo.toml | 2 +- git-storage/t/Cargo.toml | 2 +- radicle-git-ext/Cargo.toml | 2 +- radicle-git-ext/t/Cargo.toml | 2 +- radicle-surf/Cargo.toml | 2 +- radicle-surf/t/Cargo.toml | 2 +- radicle-surf/t/src/diff.rs | 78 ++++++++++++++++++------------------ 8 files changed, 48 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a9915c..9fe420c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -316,9 +316,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ "bitflags 2.4.2", "libc", @@ -385,9 +385,9 @@ checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", diff --git a/git-storage/Cargo.toml b/git-storage/Cargo.toml index 3b59e75..d530a6d 100644 --- a/git-storage/Cargo.toml +++ b/git-storage/Cargo.toml @@ -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"] diff --git a/git-storage/t/Cargo.toml b/git-storage/t/Cargo.toml index 5f69cc9..ae5eaf9 100644 --- a/git-storage/t/Cargo.toml +++ b/git-storage/t/Cargo.toml @@ -21,7 +21,7 @@ proptest = "1" path = ".." [dependencies.git2] -version = "0.18.1" +version = "0.19" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-git-ext/Cargo.toml b/radicle-git-ext/Cargo.toml index 1a5f813..3641f4c 100644 --- a/radicle-git-ext/Cargo.toml +++ b/radicle-git-ext/Cargo.toml @@ -26,7 +26,7 @@ percent-encoding = "2" thiserror = "1" [dependencies.git2] -version = "0.18.1" +version = "0.19" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-git-ext/t/Cargo.toml b/radicle-git-ext/t/Cargo.toml index 11e270d..596bbfa 100644 --- a/radicle-git-ext/t/Cargo.toml +++ b/radicle-git-ext/t/Cargo.toml @@ -24,7 +24,7 @@ serde = "1" serde_json = "1" [dependencies.git2] -version = "0.18.1" +version = "0.19" default-features = false features = ["vendored-libgit2"] diff --git a/radicle-surf/Cargo.toml b/radicle-surf/Cargo.toml index c111cef..fa9f453 100644 --- a/radicle-surf/Cargo.toml +++ b/radicle-surf/Cargo.toml @@ -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"] diff --git a/radicle-surf/t/Cargo.toml b/radicle-surf/t/Cargo.toml index 81424da..78403c6 100644 --- a/radicle-surf/t/Cargo.toml +++ b/radicle-surf/t/Cargo.toml @@ -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"] diff --git a/radicle-surf/t/src/diff.rs b/radicle-surf/t/src/diff.rs index b064c27..292df46 100644 --- a/radicle-surf/t/src/diff.rs +++ b/radicle-surf/t/src/diff.rs @@ -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) + ); +}