From 39aa59db424d9583c3430db8b19b6417a630936e Mon Sep 17 00:00:00 2001 From: Vladislav Ivanov Date: Sat, 1 Jun 2024 20:28:40 +0200 Subject: [PATCH] Refactor: drop gitoxide from gitcore While gitoxide provides a well designed set of APIs, it's more oriented towards implementing a git client than a server, and it lacks some high-level APIs like treebuilder etc. Having it alongside the regular git2 implementation works but creates additional I/O pressure which has performance implications in scenarios when a lot of transactions are opened (graphql). It would still make sense to integrate gitoxide in the future as APIs improve, but only as a complete replacement of git2 and not side by side * Remove gix from josh-core * I kept gix in proxy since it still provides nice Rust APIs for repo init and config manipulation, however... * ...I updated the version of gix to latest and disabled all extra features, which reduced dependencies a lot --- Cargo.lock | 612 +++++-------------------------- Cargo.toml | 2 +- josh-core/Cargo.toml | 1 - josh-core/src/cache.rs | 19 +- josh-core/src/compat.rs | 9 - josh-core/src/history.rs | 1 + josh-core/src/housekeeping.rs | 32 +- josh-core/src/lib.rs | 7 +- josh-proxy/src/bin/josh-proxy.rs | 27 +- 9 files changed, 121 insertions(+), 589 deletions(-) delete mode 100644 josh-core/src/compat.rs diff --git a/Cargo.lock b/Cargo.lock index 4f185ac83..38a5d954f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,19 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "ahash" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" -dependencies = [ - "cfg-if", - "getrandom", - "once_cell", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -99,12 +86,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - [[package]] name = "async-trait" version = "0.1.77" @@ -232,15 +213,6 @@ dependencies = [ "serde", ] -[[package]] -name = "btoi" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd6407f73a9b8b6162d8a2ef999fe6afd7cc15902ebf42c5cd296addf17e0ad" -dependencies = [ - "num-traits", -] - [[package]] name = "bumpalo" version = "3.15.1" @@ -259,18 +231,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" -[[package]] -name = "bytesize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" - -[[package]] -name = "byteyarn" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7534301c0ea17abb4db06d75efc7b4b0fa360fce8e175a4330d721c71c942ff" - [[package]] name = "cc" version = "1.0.86" @@ -544,41 +504,17 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "faster-hex" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239f7bfb930f820ab16a9cd95afc26f88264cf6905c960b340a615384aa3338a" -dependencies = [ - "serde", -] - [[package]] name = "faster-hex" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2a2b11eda1d40935b26cf18f6833c526845ae8c41e58d09af6adeb6f0269183" -dependencies = [ - "serde", -] [[package]] name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "filetime" -version = "0.2.23" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "windows-sys 0.52.0", -] +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "flate2" @@ -813,138 +749,72 @@ dependencies = [ [[package]] name = "gix" -version = "0.54.1" +version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad6d32e74454459690d57d18ea4ebec1629936e6b130b51d12cb4a81630ac953" +checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" dependencies = [ "gix-actor", - "gix-archive", - "gix-attributes", "gix-commitgraph", "gix-config", - "gix-credentials", "gix-date", "gix-diff", "gix-discover", "gix-features", - "gix-filter", "gix-fs", "gix-glob", "gix-hash", "gix-hashtable", - "gix-ignore", - "gix-index", "gix-lock", "gix-macros", - "gix-mailmap", - "gix-negotiate", "gix-object", "gix-odb", "gix-pack", "gix-path", - "gix-pathspec", - "gix-prompt", "gix-ref", "gix-refspec", "gix-revision", "gix-revwalk", "gix-sec", - "gix-status", - "gix-submodule", "gix-tempfile", "gix-trace", "gix-traverse", "gix-url", "gix-utils", "gix-validate", - "gix-worktree", - "gix-worktree-state", - "gix-worktree-stream", "once_cell", "parking_lot 0.12.1", - "regex", - "signal-hook", "smallvec", "thiserror", - "unicode-normalization", ] [[package]] name = "gix-actor" -version = "0.27.0" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c60e982c5290897122d4e2622447f014a2dadd5a18cb73d50bb91b31645e27" +checksum = "d69c59d392c7e6c94385b6fd6089d6df0fe945f32b4357687989f3aee253cd7f" dependencies = [ "bstr", - "btoi", "gix-date", + "gix-utils", "itoa", "thiserror", - "winnow 0.5.40", -] - -[[package]] -name = "gix-archive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab71635f7fb38ad4cc7da7e98af79e3010e35b05de5cb6eb79b2da68ab93eac7" -dependencies = [ - "bstr", - "gix-date", - "gix-object", - "gix-worktree-stream", - "thiserror", -] - -[[package]] -name = "gix-attributes" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2451665e70709ba4753b623ef97511ee98c4a73816b2c5b5df25678d607ed820" -dependencies = [ - "bstr", - "byteyarn", - "gix-glob", - "gix-path", - "gix-quote", - "gix-trace", - "smallvec", - "thiserror", - "unicode-bom", -] - -[[package]] -name = "gix-bitmap" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b6cd0f246180034ddafac9b00a112f19178135b21eb031b3f79355891f7325" -dependencies = [ - "thiserror", + "winnow", ] [[package]] name = "gix-chunk" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003ec6deacf68076a0c157271a127e0bb2c031c1a41f7168cbe5d248d9b85c78" +checksum = "45c8751169961ba7640b513c3b24af61aa962c967aaf04116734975cd5af0c52" dependencies = [ "thiserror", ] -[[package]] -name = "gix-command" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c576cfbf577f72c097b5f88aedea502cd62952bdc1fb3adcab4531d5525a4c7" -dependencies = [ - "bstr", -] - [[package]] name = "gix-commitgraph" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e75a975ee22cf0a002bfe9b5d5cb3d2a88e263a8a178cd7509133cff10f4df8a" +checksum = "f7b102311085da4af18823413b5176d7c500fb2272eaf391cfa8635d8bcb12c4" dependencies = [ "bstr", "gix-chunk", @@ -956,9 +826,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.30.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c171514b40487d3f677ae37efc0f45ac980e3169f23c27eb30a70b47fdf88ab5" +checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" dependencies = [ "bstr", "gix-config-value", @@ -972,14 +842,14 @@ dependencies = [ "smallvec", "thiserror", "unicode-bom", - "winnow 0.5.40", + "winnow", ] [[package]] name = "gix-config-value" -version = "0.14.4" +version = "0.14.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e7bfb37a46ed0b8468db37a6d8a0a61d56bdbe4603ae492cb322e5f3958" +checksum = "fbd06203b1a9b33a78c88252a625031b094d9e1b647260070c25b09910c0a804" dependencies = [ "bitflags 2.4.2", "bstr", @@ -988,27 +858,11 @@ dependencies = [ "thiserror", ] -[[package]] -name = "gix-credentials" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46900b884cc5af6a6c141ee741607c0c651a4e1d33614b8d888a1ba81cc0bc8a" -dependencies = [ - "bstr", - "gix-command", - "gix-config-value", - "gix-path", - "gix-prompt", - "gix-sec", - "gix-url", - "thiserror", -] - [[package]] name = "gix-date" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7f3dfb72bebe3449b5e642be64e3c6ccbe9821c8b8f19f487cf5bfbbf4067e" +checksum = "367ee9093b0c2b04fd04c5c7c8b6a1082713534eab537597ae343663a518fa99" dependencies = [ "bstr", "itoa", @@ -1018,24 +872,25 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.36.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "788ddb152c388206e81f36bcbb574e7ed7827c27d8fa62227b34edc333d8928c" +checksum = "40b9bd8b2d07b6675a840b56a6c177d322d45fa082672b0dad8f063b25baf0a4" dependencies = [ + "bstr", "gix-hash", "gix-object", - "imara-diff", "thiserror", ] [[package]] name = "gix-discover" -version = "0.25.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69507643d75a0ea9a402fcf73ced517d2b95cc95385904ac09d03e0b952fde33" +checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" dependencies = [ "bstr", "dunce", + "gix-fs", "gix-hash", "gix-path", "gix-ref", @@ -1045,61 +900,39 @@ dependencies = [ [[package]] name = "gix-features" -version = "0.35.0" +version = "0.38.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9ff423ae4983f762659040d13dd7a5defbd54b6a04ac3cc7347741cec828cd" +checksum = "ac7045ac9fe5f9c727f38799d002a7ed3583cd777e3322a7c4b43e3cf437dc69" dependencies = [ - "bytes", - "bytesize", "crc32fast", - "crossbeam-channel", "flate2", "gix-hash", "gix-trace", - "jwalk", + "gix-utils", "libc", "once_cell", - "parking_lot 0.12.1", "prodash", "sha1_smol", "thiserror", "walkdir", ] -[[package]] -name = "gix-filter" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be40d28cd41445bb6cd52c4d847d915900e5466f7433eaee6a9e0a3d1d88b08" -dependencies = [ - "bstr", - "encoding_rs", - "gix-attributes", - "gix-command", - "gix-hash", - "gix-object", - "gix-packetline-blocking", - "gix-path", - "gix-quote", - "gix-trace", - "smallvec", - "thiserror", -] - [[package]] name = "gix-fs" -version = "0.7.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09815faba62fe9b32d918b75a554686c98e43f7d48c43a80df58eb718e5c6635" +checksum = "c3338ff92a2164f5209f185ec0cd316f571a72676bb01d27e22f2867ba69f77a" dependencies = [ + "fastrand", "gix-features", + "gix-utils", ] [[package]] name = "gix-glob" -version = "0.13.0" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d76e85f11251dcf751d2c5e918a14f562db5be6f727fd24775245653e9b19d" +checksum = "c2a29ad0990cf02c48a7aac76ed0dbddeb5a0d070034b83675cc3bbf937eace4" dependencies = [ "bitflags 2.4.2", "bstr", @@ -1109,65 +942,30 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.13.3" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8cf8c2266f63e582b7eb206799b63aa5fa68ee510ad349f637dfe2d0653de0" +checksum = "f93d7df7366121b5018f947a04d37f034717e113dcf9ccd85c34b58e57a74d5e" dependencies = [ - "faster-hex 0.9.0", + "faster-hex", "thiserror", ] [[package]] name = "gix-hashtable" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb61880816d7ec4f0b20606b498147d480860ddd9133ba542628df2f548d3ca" +checksum = "7ddf80e16f3c19ac06ce415a38b8591993d3f73aede049cb561becb5b3a8e242" dependencies = [ "gix-hash", "hashbrown 0.14.3", "parking_lot 0.12.1", ] -[[package]] -name = "gix-ignore" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048f443a1f6b02da4205c34d2e287e3fd45d75e8e2f06cfb216630ea9bff5e3" -dependencies = [ - "bstr", - "gix-glob", - "gix-path", - "unicode-bom", -] - -[[package]] -name = "gix-index" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f54d63a9d13c13088f41f5a3accbec284e492ac8f4f707fcc307c139622e17b7" -dependencies = [ - "bitflags 2.4.2", - "bstr", - "btoi", - "filetime", - "gix-bitmap", - "gix-features", - "gix-fs", - "gix-hash", - "gix-lock", - "gix-object", - "gix-traverse", - "itoa", - "memmap2", - "smallvec", - "thiserror", -] - [[package]] name = "gix-lock" -version = "10.0.0" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47fc96fa8b6b6d33555021907c81eb3b27635daecf6e630630bdad44f8feaa95" +checksum = "e3bc7fe297f1f4614774989c00ec8b1add59571dc9b024b4c00acb7dedd4e19d" dependencies = [ "gix-tempfile", "gix-utils", @@ -1176,71 +974,44 @@ dependencies = [ [[package]] name = "gix-macros" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75e7ab728059f595f6ddc1ad8771b8d6a231971ae493d9d5948ecad366ee8bb" +checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17" dependencies = [ "proc-macro2", "quote", "syn 2.0.50", ] -[[package]] -name = "gix-mailmap" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40f00fa96e29e066ef208f5d13e0f5f95fa70c3ae4bd4f0234272ed4d708a7db" -dependencies = [ - "bstr", - "gix-actor", - "gix-date", - "thiserror", -] - -[[package]] -name = "gix-negotiate" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f1697bf9911c6d1b8d709b9e6ef718cb5ea5821a1b7991520125a8134448004" -dependencies = [ - "bitflags 2.4.2", - "gix-commitgraph", - "gix-date", - "gix-hash", - "gix-object", - "gix-revwalk", - "smallvec", - "thiserror", -] - [[package]] name = "gix-object" -version = "0.37.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7e19616c67967374137bae83e950e9b518a9ea8a605069bd6716ada357fd6f" +checksum = "1fe2dc4a41191c680c942e6ebd630c8107005983c4679214fdb1007dcf5ae1df" dependencies = [ "bstr", - "btoi", "gix-actor", "gix-date", "gix-features", "gix-hash", + "gix-utils", "gix-validate", "itoa", "smallvec", "thiserror", - "winnow 0.5.40", + "winnow", ] [[package]] name = "gix-odb" -version = "0.53.0" +version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d6a392c6ba3a2f133cdc63120e9bc7aec81eef763db372c817de31febfe64bf" +checksum = "e92b9790e2c919166865d0825b26cc440a387c175bed1b43a2fa99c0e9d45e98" dependencies = [ "arc-swap", "gix-date", "gix-features", + "gix-fs", "gix-hash", "gix-object", "gix-pack", @@ -1253,9 +1024,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.43.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7536203a45b31e1bc5694bbf90ba8da1b736c77040dd6a520db369f371eb1ab3" +checksum = "7a8da51212dbff944713edb2141ed7e002eea326b8992070374ce13a6cb610b3" dependencies = [ "clru", "gix-chunk", @@ -1269,25 +1040,13 @@ dependencies = [ "parking_lot 0.12.1", "smallvec", "thiserror", - "uluru", -] - -[[package]] -name = "gix-packetline-blocking" -version = "0.16.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d8395f7501c84d6a1fe902035fdfd8cd86d89e2dd6be0200ec1a72fd3c92d39" -dependencies = [ - "bstr", - "faster-hex 0.8.1", - "thiserror", ] [[package]] name = "gix-path" -version = "0.10.5" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97e9ad649bf5e109562d6acba657ca428661ec08e77eaf3a755d8fa55485be9c" +checksum = "23623cf0f475691a6d943f898c4d0b89f5c1a2a64d0f92bce0e0322ee6528783" dependencies = [ "bstr", "gix-trace", @@ -1296,50 +1055,22 @@ dependencies = [ "thiserror", ] -[[package]] -name = "gix-pathspec" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e26c9b47c51be73f98d38c84494bd5fb99334c5d6fda14ef5d036d50a9e5fd" -dependencies = [ - "bitflags 2.4.2", - "bstr", - "gix-attributes", - "gix-config-value", - "gix-glob", - "gix-path", - "thiserror", -] - -[[package]] -name = "gix-prompt" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c9a913769516f5e9d937afac206fb76428e3d7238e538845842887fda584678" -dependencies = [ - "gix-command", - "gix-config-value", - "parking_lot 0.12.1", - "rustix", - "thiserror", -] - [[package]] name = "gix-quote" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7dc10303d73a960d10fb82f81188b036ac3e6b11b5795b20b1a60b51d1321f" +checksum = "cbff4f9b9ea3fa7a25a70ee62f545143abef624ac6aa5884344e70c8b0a1d9ff" dependencies = [ "bstr", - "btoi", + "gix-utils", "thiserror", ] [[package]] name = "gix-ref" -version = "0.37.0" +version = "0.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e6b749660b613641769edc1954132eb8071a13c32224891686091bef078de4" +checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" dependencies = [ "gix-actor", "gix-date", @@ -1350,17 +1081,18 @@ dependencies = [ "gix-object", "gix-path", "gix-tempfile", + "gix-utils", "gix-validate", "memmap2", "thiserror", - "winnow 0.5.40", + "winnow", ] [[package]] name = "gix-refspec" -version = "0.18.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0895cb7b1e70f3c3bd4550c329e9f5caf2975f97fcd4238e05754e72208ef61e" +checksum = "dde848865834a54fe4d9b4573f15d0e9a68eaf3d061b42d3ed52b4b8acf880b2" dependencies = [ "bstr", "gix-hash", @@ -1372,9 +1104,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.22.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8c4b15cf2ab7a35f5bcb3ef146187c8d36df0177e171ca061913cbaaa890e89" +checksum = "63e08f8107ed1f93a83bcfbb4c38084c7cb3f6cd849793f1d5eec235f9b13b2b" dependencies = [ "bstr", "gix-date", @@ -1388,9 +1120,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.8.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9870c6b1032f2084567710c3b2106ac603377f8d25766b8a6b7c33e6e3ca279" +checksum = "4181db9cfcd6d1d0fd258e91569dbb61f94cb788b441b5294dd7f1167a3e788f" dependencies = [ "gix-commitgraph", "gix-date", @@ -1403,9 +1135,9 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.4" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8d9bf462feaf05f2121cba7399dbc6c34d88a9cad58fc1e95027791d6a3c6d2" +checksum = "fddc27984a643b20dd03e97790555804f98cf07404e0e552c0ad8133266a79a1" dependencies = [ "bitflags 2.4.2", "gix-path", @@ -1413,66 +1145,32 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "gix-status" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "082801c42ba707f2407b5cce3d99b89cfa84f3794962946dc94cfdc00ae522fa" -dependencies = [ - "bstr", - "filetime", - "gix-features", - "gix-fs", - "gix-hash", - "gix-index", - "gix-object", - "gix-path", - "gix-pathspec", - "thiserror", -] - -[[package]] -name = "gix-submodule" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0150e82e9282d3f2ab2dd57a22f9f6c3447b9d9856e5321ac92d38e3e0e2b7" -dependencies = [ - "bstr", - "gix-config", - "gix-path", - "gix-pathspec", - "gix-refspec", - "gix-url", - "thiserror", -] - [[package]] name = "gix-tempfile" -version = "10.0.0" +version = "14.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ae0978f3e11dc57290ee75ac2477c815bca1ce2fa7ed5dc5f16db067410ac4d" +checksum = "d3b0e276cd08eb2a22e9f286a4f13a222a01be2defafa8621367515375644b99" dependencies = [ "gix-fs", "libc", "once_cell", "parking_lot 0.12.1", - "signal-hook", - "signal-hook-registry", "tempfile", ] [[package]] name = "gix-trace" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b202d766a7fefc596e2cc6a89cda8ad8ad733aed82da635ac120691112a9b1" +checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" [[package]] name = "gix-traverse" -version = "0.33.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ef04ab3643acba289b5cedd25d6f53c0430770b1d689d1d654511e6fb81ba0" +checksum = "f20cb69b63eb3e4827939f42c05b7756e3488ef49c25c412a876691d568ee2a0" dependencies = [ + "bitflags 2.4.2", "gix-commitgraph", "gix-date", "gix-hash", @@ -1485,9 +1183,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.24.0" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6125ecf46e8c68bf7202da6cad239831daebf0247ffbab30210d72f3856e420f" +checksum = "0db829ebdca6180fbe32be7aed393591df6db4a72dbbc0b8369162390954d1cf" dependencies = [ "bstr", "gix-features", @@ -1499,9 +1197,9 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.9" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e839f3d0798b296411263da6bee780a176ef8008a5dfc31287f7eda9266ab8" +checksum = "35192df7fd0fa112263bad8021e2df7167df4cc2a6e6d15892e1e55621d3d4dc" dependencies = [ "fastrand", "unicode-normalization", @@ -1509,67 +1207,11 @@ dependencies = [ [[package]] name = "gix-validate" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac7cc36f496bd5d96cdca0f9289bb684480725d40db60f48194aa7723b883854" -dependencies = [ - "bstr", - "thiserror", -] - -[[package]] -name = "gix-worktree" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5e32972801bd82d56609e6fc84efc358fa1f11f25c5e83b7807ee2280f14fe" -dependencies = [ - "bstr", - "gix-attributes", - "gix-features", - "gix-fs", - "gix-glob", - "gix-hash", - "gix-ignore", - "gix-index", - "gix-object", - "gix-path", -] - -[[package]] -name = "gix-worktree-state" -version = "0.3.0" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3aeb06960f2c5ac9e4cdb6b38eb3c2b99d5e525e68285fef21ed17dfbd597ad" +checksum = "82c27dd34a49b1addf193c92070bcbf3beaf6e10f16a78544de6372e146a0acf" dependencies = [ "bstr", - "gix-features", - "gix-filter", - "gix-fs", - "gix-glob", - "gix-hash", - "gix-index", - "gix-object", - "gix-path", - "gix-worktree", - "io-close", - "thiserror", -] - -[[package]] -name = "gix-worktree-stream" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89fe93a12e45cc3ad6ba429a7dd7506b03d7d406374a65ad9998b5cb2627569" -dependencies = [ - "gix-attributes", - "gix-features", - "gix-filter", - "gix-fs", - "gix-hash", - "gix-object", - "gix-path", - "gix-traverse", - "parking_lot 0.12.1", "thiserror", ] @@ -1691,12 +1333,6 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" -[[package]] -name = "human_format" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3b1f728c459d27b12448862017b96ad4767b1ec2ec5e6434e99f1577f085b8" - [[package]] name = "humantime" version = "2.1.0" @@ -1807,16 +1443,6 @@ dependencies = [ "unicode-normalization", ] -[[package]] -name = "imara-diff" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98c1d0ad70fc91b8b9654b1f33db55e59579d3b3de2bffdced0fdb810570cb8" -dependencies = [ - "ahash", - "hashbrown 0.12.3", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -1859,16 +1485,6 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" -[[package]] -name = "io-close" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "ipnet" version = "2.9.0" @@ -1917,9 +1533,9 @@ dependencies = [ "backtrace", "bitvec", "chrono", + "form_urlencoded", "git-version", "git2", - "gix", "glob", "handlebars", "hex", @@ -2168,9 +1784,9 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memmap2" -version = "0.7.1" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49388d20533534cd19360ad3d6a7dadc885944aa802ba3995040c5ec11288c6" +checksum = "fe751422e4a8caa417e13c3ea66452215d7d63e19e604f4980461212f3ae1322" dependencies = [ "libc", ] @@ -2656,13 +2272,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" -dependencies = [ - "bytesize", - "human_format", -] +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" [[package]] name = "prost" @@ -3081,16 +2693,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -3462,7 +3064,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.2", + "winnow", ] [[package]] @@ -3641,15 +3243,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" -[[package]] -name = "uluru" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db" -dependencies = [ - "arrayvec", -] - [[package]] name = "unicase" version = "2.7.0" @@ -4012,15 +3605,6 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.2" @@ -4048,23 +3632,3 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.50", -] diff --git a/Cargo.toml b/Cargo.toml index a25a915df..49349d65c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ codegen-units = 1 defer = "0.1.0" env_logger = "0.10.0" futures = "0.3.28" -gix = "0.54.1" +gix = { version = "0.63.0", default-features = false } hyper-reverse-proxy = "0.5.1" lazy_static = "1.4.0" libc = "0.2.148" diff --git a/josh-core/Cargo.toml b/josh-core/Cargo.toml index 3021920a5..a21a7162b 100644 --- a/josh-core/Cargo.toml +++ b/josh-core/Cargo.toml @@ -34,7 +34,6 @@ sled = "0.34.7" strfmt = "0.2.4" toml = { workspace = true } tracing = { workspace = true } -gix = { workspace = true } juniper = { workspace = true } form_urlencoded = "1.2.1" diff --git a/josh-core/src/cache.rs b/josh-core/src/cache.rs index bd66281c7..5081758db 100644 --- a/josh-core/src/cache.rs +++ b/josh-core/src/cache.rs @@ -68,7 +68,6 @@ struct Transaction2 { pub struct Transaction { t2: std::cell::RefCell, repo: git2::Repository, - oxide_repo: gix::Repository, ref_prefix: String, } @@ -83,7 +82,6 @@ impl Transaction { git2::RepositoryOpenFlags::NO_SEARCH, &[] as &[&std::ffi::OsStr], )?, - gix::ThreadSafeRepository::open(path)?.to_thread_local(), ref_prefix, )) } @@ -95,11 +93,7 @@ impl Transaction { load(&path)? }; - Ok(Transaction::new( - repo, - gix::ThreadSafeRepository::open(path)?.to_thread_local(), - None, - )) + Ok(Transaction::new(repo, None)) } pub fn status(&self, _msg: &str) { @@ -108,11 +102,7 @@ impl Transaction { /* t2.out.flush().ok(); */ } - fn new( - repo: git2::Repository, - oxide_repo: gix::Repository, - ref_prefix: Option<&str>, - ) -> Transaction { + fn new(repo: git2::Repository, ref_prefix: Option<&str>) -> Transaction { log::debug!("new transaction"); let path_tree = DB .lock() @@ -151,7 +141,6 @@ impl Transaction { walks: 0, }), repo, - oxide_repo, ref_prefix: ref_prefix.unwrap_or("").to_string(), } } @@ -164,10 +153,6 @@ impl Transaction { &self.repo } - pub fn oxide_repo(&self) -> &gix::Repository { - &self.oxide_repo - } - pub fn refname(&self, r: &str) -> String { format!("{}{}", self.ref_prefix, r) } diff --git a/josh-core/src/compat.rs b/josh-core/src/compat.rs deleted file mode 100644 index 957c8f57e..000000000 --- a/josh-core/src/compat.rs +++ /dev/null @@ -1,9 +0,0 @@ -pub trait GitOxideCompatExt { - fn to_git2(self) -> T; -} - -impl GitOxideCompatExt for gix::ObjectId { - fn to_git2(self) -> git2::Oid { - git2::Oid::from_bytes(self.as_slice()).expect("failed to convert oid") - } -} diff --git a/josh-core/src/history.rs b/josh-core/src/history.rs index 5f42417be..4fc771444 100644 --- a/josh-core/src/history.rs +++ b/josh-core/src/history.rs @@ -1,4 +1,5 @@ use super::*; +use std::collections::HashMap; pub fn walk2( filter: filter::Filter, diff --git a/josh-core/src/housekeeping.rs b/josh-core/src/housekeeping.rs index 1592d7946..86109ddfd 100644 --- a/josh-core/src/housekeeping.rs +++ b/josh-core/src/housekeeping.rs @@ -1,8 +1,7 @@ -use git2; - -use super::*; +use crate::*; +use itertools::Itertools; use std::collections::{BTreeSet, HashMap}; -use std::path::{Path, PathBuf}; +use std::path::Path; use tracing::{info, span, Level}; pub type KnownViews = HashMap)>; @@ -13,28 +12,33 @@ lazy_static! { } pub fn list_refs( - repo: &gix::Repository, + repo: &git2::Repository, upstream_repo: &str, -) -> JoshResult> { +) -> JoshResult> { let mut refs = vec![]; let prefix = ["refs", "josh", "upstream", &to_ns(upstream_repo)] .iter() - .collect::(); + .join("/"); - for group in [ - prefix.join("refs").join("heads"), - prefix.join("refs").join("tags"), + for glob in [ + format!("{}/refs/heads/*", &prefix), + format!("{}/refs/tags/*", &prefix), ] .iter() { - for reference in repo.references()?.prefixed(group)? { + for reference in repo.references_glob(&glob)? { let reference = reference.map_err(|e| josh_error(&format!("unable to obtain reference: {}", e)))?; - let name = reference.name().to_path().strip_prefix(&prefix)?; - let oid = gix::ObjectId::from(reference.target().id()); - refs.push((name.to_owned(), oid)) + if let (Some(name), Some(target)) = (reference.name(), reference.target()) { + let name = name + .strip_prefix(&prefix) + .and_then(|name| name.strip_prefix('/')) + .ok_or_else(|| josh_error("bug: unexpected result of a glob"))?; + + refs.push((name.to_owned(), target)) + } } } diff --git a/josh-core/src/lib.rs b/josh-core/src/lib.rs index 085ad25f2..4536465eb 100644 --- a/josh-core/src/lib.rs +++ b/josh-core/src/lib.rs @@ -34,10 +34,7 @@ extern crate pest_derive; #[macro_use] extern crate serde_json; -use std::collections::HashMap; - pub mod cache; -pub mod compat; pub mod filter; pub mod graphql; pub mod history; @@ -367,14 +364,14 @@ pub fn normalize_path(path: &std::path::Path) -> std::path::PathBuf { ret } -type Users = HashMap; +type Users = std::collections::HashMap; #[derive(Debug, serde::Deserialize)] struct User { pub groups: toml::value::Array, } -type Groups = HashMap>; +type Groups = std::collections::HashMap>; #[derive(Debug, serde::Deserialize)] struct Group { pub whitelist: String, diff --git a/josh-proxy/src/bin/josh-proxy.rs b/josh-proxy/src/bin/josh-proxy.rs index ba69cf69e..4ebf632b7 100644 --- a/josh-proxy/src/bin/josh-proxy.rs +++ b/josh-proxy/src/bin/josh-proxy.rs @@ -17,7 +17,6 @@ use hyper::service::{make_service_fn, service_fn}; use hyper::{Request, Response, Server, StatusCode}; use indoc::formatdoc; -use josh::compat::GitOxideCompatExt; use josh::{josh_error, JoshError, JoshResult}; use josh_rpc::calls::RequestedCommand; use serde::Serialize; @@ -433,7 +432,7 @@ async fn do_filter( )), )?; - let resolve_ref = |ref_value: &str| -> JoshResult { + let resolve_ref = |ref_value: &str| -> JoshResult { let josh_name = [ "refs", "josh", @@ -445,11 +444,11 @@ async fn do_filter( .collect::(); Ok(transaction - .oxide_repo() + .repo() .find_reference(josh_name.to_str().unwrap()) .map_err(|e| josh_error(&format!("Could not find ref: {}", e)))? - .id() - .into()) + .target() + .ok_or(josh_error("Could not resolve ref"))?) }; let (refs_list, head_ref) = match &head_ref { @@ -457,30 +456,27 @@ async fn do_filter( if ref_value.starts_with("refs/") || ref_value == "HEAD" => { let object = resolve_ref(&ref_value)?; - let list = vec![(PathBuf::from(ref_value), object)]; + let list = vec![(ref_value.clone(), object)]; (list, ref_value.clone()) } HeadRef::Explicit(ref_value) => { // When it's not something starting with refs/ or HEAD, it's // probably sha1 - let list = vec![( - PathBuf::from(ref_value), - gix::ObjectId::from_str(&ref_value)?, - )]; - let synthetic_ref = format!("refs/heads/_{}", ref_value); + let list = vec![(ref_value.to_string(), git2::Oid::from_str(&ref_value)?)]; + let synthetic_ref = format!("refs/heads/_{}", ref_value); (list, synthetic_ref) } HeadRef::Implicit => { // When user did not explicitly request a ref to filter, // start with a list of all existing refs let mut list = - josh::housekeeping::list_refs(transaction.oxide_repo(), &meta.config.repo)?; + josh::housekeeping::list_refs(transaction.repo(), &meta.config.repo)?; let head_ref = head_ref.get().to_string(); if let Ok(object) = resolve_ref(&head_ref) { - list.push((PathBuf::from(&head_ref), object)); + list.push((head_ref.clone(), object)); } (list, head_ref) @@ -497,11 +493,6 @@ async fn do_filter( head_ref }; - let refs_list = refs_list - .iter() - .map(|(reference, oid)| (reference.to_str().unwrap().to_string(), oid.to_git2())) - .collect::>(); - let t2 = josh::cache::Transaction::open(&repo_path.join("overlay"), None)?; t2.repo() .odb()?