From 421ab592bed673c9fe955c4ac63c5acaf0fccc98 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 9 Feb 2024 18:24:49 +0900 Subject: [PATCH] cargo: bump gix to 0.58.0, migrate to ObjectId::try_from() The panicking conversion function appears to be renamed, and try_from() is added instead. --- Cargo.lock | 131 ++++++++++++++++++++--------------------- Cargo.toml | 2 +- lib/src/git.rs | 4 +- lib/src/git_backend.rs | 20 ++++--- 4 files changed, 77 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad0ad6a1a..aaaf63b73 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -917,9 +917,9 @@ dependencies = [ [[package]] name = "gix" -version = "0.56.0" +version = "0.58.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0dcdc9c60d66535897fa40a7ea2a635e72f99456b1d9ae86b7e170e80618cb" +checksum = "31887c304d9a935f3e5494fb5d6a0106c34e965168ec0db9b457424eedd0c741" dependencies = [ "gix-actor", "gix-commitgraph", @@ -954,14 +954,13 @@ dependencies = [ "parking_lot", "smallvec", "thiserror", - "unicode-normalization", ] [[package]] name = "gix-actor" -version = "0.28.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eadca029ef716b4378f7afb19f7ee101fde9e58ba1f1445971315ac866db417" +checksum = "0a7bb9fad6125c81372987c06469601d37e1a2d421511adb69971b9083517a8a" dependencies = [ "bstr", "btoi", @@ -991,9 +990,9 @@ dependencies = [ [[package]] name = "gix-commitgraph" -version = "0.22.1" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7007ba021f059803afaf6f8a48872422abc20550ac12ede6ddea2936cec36" +checksum = "82dbd7fb959862e3df2583331f0ad032ac93533e8a52f1b0694bc517f5d292bc" dependencies = [ "bstr", "gix-chunk", @@ -1005,9 +1004,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.32.1" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0341471d55d8676e98b88e121d7065dfa4c9c5acea4b6d6ecdd2846e85cce0c3" +checksum = "e62bf2073b6ce3921ffa6d8326f645f30eec5fc4a8e8a4bc0fcb721a2f3f69dc" dependencies = [ "bstr", "gix-config-value", @@ -1026,9 +1025,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" +checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" dependencies = [ "bitflags 2.4.2", "bstr", @@ -1051,9 +1050,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.38.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8119a985887cfe68f4bdf92e51bd64bc758a73882d82fcfc03ebcb164441c85d" +checksum = "cbdcb5e49c4b9729dd1c361040ae5c3cd7c497b2260b18c954f62db3a63e98cf" dependencies = [ "bstr", "gix-hash", @@ -1063,12 +1062,13 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fad89416ebe0b3b7df78464124e2a02417b6cd3743d48ad93df86f4d2929c07" +checksum = "b4669218f3ec0cbbf8f16857b32200890f8ca585f36f5817242e4115fe4551af" dependencies = [ "bstr", "dunce", + "gix-fs", "gix-hash", "gix-path", "gix-ref", @@ -1078,15 +1078,16 @@ dependencies = [ [[package]] name = "gix-features" -version = "0.36.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d46a4a5c6bb5bebec9c0d18b65ada20e6517dbd7cf855b87dd4bbdce3a771b2" +checksum = "184f7f7d4e45db0e2a362aeaf12c06c5e84817d0ef91d08e8e90170dad9f0b07" dependencies = [ "crc32fast", "crossbeam-channel", "flate2", "gix-hash", "gix-trace", + "gix-utils", "jwalk", "libc", "once_cell", @@ -1099,18 +1100,19 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.8.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20e86eb040f5776a5ade092282e51cdcad398adb77d948b88d17583c2ae4e107" +checksum = "4436e883d5769f9fb18677b8712b49228357815f9e4104174a6fc2d8461a437b" dependencies = [ "gix-features", + "gix-utils", ] [[package]] name = "gix-glob" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" +checksum = "4965a1d06d0ab84a29d4a67697a97352ab14ae1da821084e5afb1fd6d8191ca0" dependencies = [ "bitflags 2.4.2", "bstr", @@ -1120,9 +1122,9 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.13.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8cf8c2266f63e582b7eb206799b63aa5fa68ee510ad349f637dfe2d0653de0" +checksum = "b0ed89cdc1dce26685c80271c4287077901de3c3dd90234d5fa47c22b2268653" dependencies = [ "faster-hex", "thiserror", @@ -1130,9 +1132,9 @@ dependencies = [ [[package]] name = "gix-hashtable" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb61880816d7ec4f0b20606b498147d480860ddd9133ba542628df2f548d3ca" +checksum = "ebe47d8c0887f82355e2e9e16b6cecaa4d5e5346a7a474ca78ff94de1db35a5b" dependencies = [ "gix-hash", "hashbrown", @@ -1141,9 +1143,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.27.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f308f5cd2992e96a274b0d1931e9a0e44fdcba87695ead3f6df30d8a697e9c" +checksum = "1d7152181ba8f0a3addc5075dd612cea31fc3e252b29c8be8c45f4892bf87426" dependencies = [ "bitflags 2.4.2", "bstr", @@ -1166,9 +1168,9 @@ dependencies = [ [[package]] name = "gix-lock" -version = "11.0.1" +version = "13.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5c65e6a29830a435664891ced3f3c1af010f14900226019590ee0971a22f37" +checksum = "886490a07b1d6433aa91262a99d430a91cc8b9a1f758ac1282e132f1098a9342" dependencies = [ "gix-tempfile", "gix-utils", @@ -1188,9 +1190,9 @@ dependencies = [ [[package]] name = "gix-object" -version = "0.39.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "febf79c5825720c1c63fe974c7bbe695d0cb54aabad73f45671c60ce0e501e33" +checksum = "693ce9d30741506cb082ef2d8b797415b48e032cce0ab23eff894c19a7e4777b" dependencies = [ "bstr", "btoi", @@ -1207,13 +1209,14 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.55.0" +version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fae5f971540c99c6ecc8d4368ecc9d18a9dc8b9391025c68c4399747dc93bac" +checksum = "8ba2fa9e81f2461b78b4d81a807867667326c84cdab48e0aed7b73a593aa1be4" dependencies = [ "arc-swap", "gix-date", "gix-features", + "gix-fs", "gix-hash", "gix-object", "gix-pack", @@ -1226,9 +1229,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.45.0" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569491c92446fddf373456ff360aff9a9effd627b40a70f2d7914dcd75a3205" +checksum = "8da5f3e78c96b76c4e6fe5e8e06b76221e4a0ee9a255aa935ed1fdf68988dfd8" dependencies = [ "clru", "gix-chunk", @@ -1247,9 +1250,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.3" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" +checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" dependencies = [ "bstr", "gix-trace", @@ -1271,9 +1274,9 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.39.1" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2069adc212cf7f3317ef55f6444abd06c50f28479dbbac5a86acf3b05cbbfe" +checksum = "5818958994ad7879fa566f5441ebcc48f0926aa027b28948e6fbf6578894dc31" dependencies = [ "gix-actor", "gix-date", @@ -1284,6 +1287,7 @@ dependencies = [ "gix-object", "gix-path", "gix-tempfile", + "gix-utils", "gix-validate", "memmap2", "thiserror", @@ -1292,9 +1296,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d9d3b82e1ee78fc0dc1c37ea5ea76c2dbc73f407db155f0dfcea285e583bee" +checksum = "613aa4d93034c5791d13bdc635e530f4ddab1412ddfb4a8215f76213177b61c7" dependencies = [ "bstr", "gix-hash", @@ -1306,9 +1310,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.24.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5dd51710ce5434bc315ea30394fab483c5377276494edd79222b321a5a9544" +checksum = "288f6549d7666db74dc3f169a9a333694fc28ecd2f5aa7b2c979c89eb556751a" dependencies = [ "bstr", "gix-date", @@ -1322,9 +1326,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d4ed2493ca94a475fdf147138e1ef8bab3b6ebb56abf3d9bda1c05372ec1dd" +checksum = "5b9b4d91dfc5c14fee61a28c65113ded720403b65a0f46169c0460f731a5d03c" dependencies = [ "gix-commitgraph", "gix-date", @@ -1337,21 +1341,21 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" +checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" dependencies = [ "bitflags 2.4.2", "gix-path", "libc", - "windows", + "windows-sys 0.52.0", ] [[package]] name = "gix-tempfile" -version = "11.0.1" +version = "13.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388dd29114a86ec69b28d1e26d6d63a662300ecf61ab3f4cc578f7d7dc9e7e23" +checksum = "439f4da9657aec7434cde3c2510dcdb0a35f2031233ff67ae986269c788966d7" dependencies = [ "gix-fs", "libc", @@ -1368,9 +1372,9 @@ checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" [[package]] name = "gix-traverse" -version = "0.35.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2112088122a0206592c84fbd42020db63b2ccaed66a0293779f2e5fbf80474" +checksum = "bfc30c5b5e4e838683b59e1b0574ce6bc1c35916df9709aaab32bb7751daf08b" dependencies = [ "gix-commitgraph", "gix-date", @@ -1384,9 +1388,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.25.2" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c427a1a11ccfa53a4a2da47d9442c2241deee63a154bc15cc14b8312fbc4005" +checksum = "26f1981ecc700f4fd73ae62b9ca2da7c8816c8fd267f0185e3f8c21e967984ac" dependencies = [ "bstr", "gix-features", @@ -1398,11 +1402,12 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" +checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" dependencies = [ "fastrand", + "unicode-normalization", ] [[package]] @@ -2189,9 +2194,9 @@ dependencies = [ [[package]] name = "prodash" -version = "26.2.2" +version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794b5bf8e2d19b53dcdcec3e4bba628e20f5b6062503ba89281fa7037dd7bbcf" +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" [[package]] name = "prost" @@ -3296,16 +3301,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" -dependencies = [ - "windows-core", - "windows-targets 0.52.0", -] - [[package]] name = "windows-core" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 9029c55cf..2094d1398 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,7 +47,7 @@ either = "1.9.0" esl01-renderdag = "0.3.0" futures = "0.3.30" git2 = "0.18.2" -gix = { version = "0.56.0", default-features = false, features = [ +gix = { version = "0.58.0", default-features = false, features = [ "index", "max-performance-safe", ] } diff --git a/lib/src/git.rs b/lib/src/git.rs index ed7a29c71..d38636731 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -794,7 +794,7 @@ fn diff_refs_to_export( continue; } let old_oid = if let Some(id) = old_target.as_normal() { - Some(gix::ObjectId::from(id.as_bytes())) + Some(gix::ObjectId::try_from(id.as_bytes()).unwrap()) } else if old_target.has_conflict() { // The old git ref should only be a conflict if there were concurrent import // operations while the value changed. Don't overwrite these values. @@ -805,7 +805,7 @@ fn diff_refs_to_export( None }; if let Some(id) = new_target.as_normal() { - let new_oid = gix::ObjectId::from(id.as_bytes()); + let new_oid = gix::ObjectId::try_from(id.as_bytes()).unwrap(); branches_to_update.insert(ref_name, (old_oid, new_oid)); } else if new_target.has_conflict() { // Skip conflicts and leave the old value in git_refs diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index a7918bc60..1e63a7b46 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -713,7 +713,7 @@ fn validate_git_object_id(id: &impl ObjectId) -> Result BackendError { @@ -941,7 +941,7 @@ impl Backend for GitBackend { } => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Blob.into(), filename: name.into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, TreeValue::File { id, @@ -949,27 +949,27 @@ impl Backend for GitBackend { } => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::BlobExecutable.into(), filename: name.into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, TreeValue::Symlink(id) => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Link.into(), filename: name.into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, TreeValue::Tree(id) => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Tree.into(), filename: name.into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, TreeValue::GitSubmodule(id) => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Commit.into(), filename: name.into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, TreeValue::Conflict(id) => gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Blob.into(), filename: (name.to_owned() + CONFLICT_SUFFIX).into(), - oid: id.as_bytes().into(), + oid: id.as_bytes().try_into().unwrap(), }, } }) @@ -1202,7 +1202,7 @@ fn write_tree_conflict( .map(|(name, tree_id)| gix::objs::tree::Entry { mode: gix::object::tree::EntryKind::Tree.into(), filename: name.into(), - oid: tree_id.as_bytes().into(), + oid: tree_id.as_bytes().try_into().unwrap(), }) .sorted_unstable() .collect(); @@ -1908,7 +1908,9 @@ mod tests { .unwrap(); let git_repo = backend.git_repo(); - let obj = git_repo.find_object(id.as_bytes()).unwrap(); + let obj = git_repo + .find_object(gix::ObjectId::try_from(id.as_bytes()).unwrap()) + .unwrap(); insta::assert_snapshot!(std::str::from_utf8(&obj.data).unwrap(), @r###" tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 author Someone 0 +0000