From cf3f8b0aea4c8be55a11540af08e9a6be214491f Mon Sep 17 00:00:00 2001 From: emma Date: Fri, 6 Mar 2026 18:05:57 -0700 Subject: [PATCH] reorganize code & switch to gix --- Cargo.lock | 1735 +++++++++++++++++++++----- Cargo.toml | 3 +- src/backend/git.rs | 69 + src/backend/mod.rs | 2 + src/{ => backend}/render.rs | 0 src/backend/test.rs | 25 + src/bin/backend/git.rs | 62 + src/bin/backend/render.rs | 65 + src/{ => bin/backend}/test-render.rs | 22 +- src/bin/backend/test.rs | 25 + src/bin/test_render.rs | 91 ++ src/git.rs | 247 ---- src/lib.rs | 1 + 13 files changed, 1788 insertions(+), 559 deletions(-) create mode 100644 src/backend/git.rs create mode 100644 src/backend/mod.rs rename src/{ => backend}/render.rs (100%) create mode 100644 src/backend/test.rs create mode 100644 src/bin/backend/git.rs create mode 100644 src/bin/backend/render.rs rename src/{ => bin/backend}/test-render.rs (86%) create mode 100644 src/bin/backend/test.rs create mode 100644 src/bin/test_render.rs delete mode 100644 src/git.rs diff --git a/Cargo.lock b/Cargo.lock index bb77c6f..82e741c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -26,6 +32,21 @@ dependencies = [ "libc", ] +[[package]] +name = "arc-swap" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f3647c145568cec02c42054e07bdf9a5a698e15b466fb2341bfc393cd24aa5" +dependencies = [ + "rustversion", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "autocfg" version = "1.5.0" @@ -54,6 +75,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234113d19d0d7d613b40e86fb654acf958910802bcceab913a4f9e7cda03b1a4" dependencies = [ "memchr", + "regex-automata", "serde", ] @@ -63,14 +85,30 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "bytesize" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bd91ee7b2422bcb158d90ef4d14f75ef67f340943fc4149891dcce8f8b972a3" + [[package]] name = "cc" version = "1.2.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2352e5597e9c544d5e6d9c95190d5d27738ade584fa8db0a16e130e5c2b5296e" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -89,7 +127,7 @@ dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -114,6 +152,15 @@ dependencies = [ "phf_codegen", ] +[[package]] +name = "clru" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "197fd99cb113a8d5d9b6376f3aa817f32c1078f2343b714fff7d2ca44fdf67d5" +dependencies = [ + "hashbrown 0.16.1", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -129,6 +176,24 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -164,6 +229,20 @@ dependencies = [ "typenum", ] +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "deunicode" version = "1.6.2" @@ -181,15 +260,10 @@ dependencies = [ ] [[package]] -name = "displaydoc" -version = "0.2.5" +name = "dunce" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" [[package]] name = "either" @@ -198,14 +272,75 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] -name = "form_urlencoded" -version = "1.2.1" +name = "encoding_rs" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ - "percent-encoding", + "cfg-if", ] +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "faster-hex" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7223ae2d2f179b803433d9c830478527e92b8117eab39460edae7f1614d9fb73" +dependencies = [ + "heapless", + "serde", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "filetime" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f98844151eee8917efc50bd9e8318cb963ae8b297431495d3f758616ea5c57db" +dependencies = [ + "cfg-if", + "libc", + "libredox", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "futures" version = "0.3.32" @@ -316,16 +451,892 @@ dependencies = [ ] [[package]] -name = "git2" -version = "0.20.2" +name = "gix" +version = "0.78.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110" +checksum = "3428a03ace494ae40308bd3df0b37e7eb7403e24389f27abdff30abf2b5adf17" +dependencies = [ + "gix-actor", + "gix-archive", + "gix-attributes", + "gix-blame", + "gix-command", + "gix-commitgraph", + "gix-config", + "gix-credentials", + "gix-date", + "gix-diff", + "gix-dir", + "gix-discover", + "gix-error", + "gix-features", + "gix-filter", + "gix-fs", + "gix-glob", + "gix-hash", + "gix-hashtable", + "gix-ignore", + "gix-index", + "gix-lock", + "gix-mailmap", + "gix-negotiate", + "gix-object", + "gix-odb", + "gix-pack", + "gix-path", + "gix-pathspec", + "gix-prompt", + "gix-protocol", + "gix-ref", + "gix-refspec", + "gix-revision", + "gix-revwalk", + "gix-sec", + "gix-shallow", + "gix-status", + "gix-submodule", + "gix-tempfile", + "gix-trace", + "gix-traverse", + "gix-url", + "gix-utils", + "gix-validate", + "gix-worktree", + "gix-worktree-state", + "gix-worktree-stream", + "parking_lot", + "regex", + "signal-hook", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-actor" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50ce5433eaa46187349e59089eea71b0397caa71991b2fa3e124120426d7d15" +dependencies = [ + "bstr", + "gix-date", + "gix-utils", + "itoa", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-archive" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388d1d2e5ec852a3af138c0e11d73aa6800490c88eac94970a7b653beab0dcd0" +dependencies = [ + "bstr", + "gix-date", + "gix-object", + "gix-worktree-stream", + "thiserror", +] + +[[package]] +name = "gix-attributes" +version = "0.30.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e72da5a1c35c9a129be0c60ab9968779981ca50835dd98650ecd8b0ea4d721e" +dependencies = [ + "bstr", + "gix-glob", + "gix-path", + "gix-quote", + "gix-trace", + "kstring", + "smallvec", + "thiserror", + "unicode-bom", +] + +[[package]] +name = "gix-bitmap" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d982fc7ef0608e669851d0d2a6141dae74c60d5a27e8daa451f2a4857bbf41e2" +dependencies = [ + "thiserror", +] + +[[package]] +name = "gix-blame" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e0bf0ff9a7ce3f34832565b5aa13ae923feacd1154e2fbbfa5de9b740e26288" +dependencies = [ + "gix-commitgraph", + "gix-date", + "gix-diff", + "gix-error", + "gix-hash", + "gix-object", + "gix-revwalk", + "gix-trace", + "gix-traverse", + "gix-worktree", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-chunk" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e516efaac951ed21115b11d5514b120c26ccb493d0c0b9ea6cc10edf4fdf44" +dependencies = [ + "gix-error", +] + +[[package]] +name = "gix-command" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2962172c6f78731e2b7773bf762f7b8d1746a342a4c0a8914a612206e1295953" +dependencies = [ + "bstr", + "gix-path", + "gix-quote", + "gix-trace", + "shell-words", +] + +[[package]] +name = "gix-commitgraph" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0dda2e4d5a61d4a16a780f61f2b7e9406ad1f8da97c35c09ef501f3fdf74de0" +dependencies = [ + "bstr", + "gix-chunk", + "gix-error", + "gix-hash", + "memmap2", +] + +[[package]] +name = "gix-config" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a153dd4f5789fdf242e19e3f7105f2a114df198570225976fe4a108bac9dee4" +dependencies = [ + "bstr", + "gix-config-value", + "gix-features", + "gix-glob", + "gix-path", + "gix-ref", + "gix-sec", + "memchr", + "smallvec", + "thiserror", + "unicode-bom", + "winnow", +] + +[[package]] +name = "gix-config-value" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "441a300bc3645a1f45cba495b9175f90f47256ce43f2ee161da0031e3ac77c92" dependencies = [ "bitflags", + "bstr", + "gix-path", "libc", - "libgit2-sys", - "log", - "url", + "thiserror", +] + +[[package]] +name = "gix-credentials" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6ef04ac6b0b9cb75b02afaab4045eafb7b59be41815fbfaaa184a2280af2146" +dependencies = [ + "bstr", + "gix-command", + "gix-config-value", + "gix-date", + "gix-path", + "gix-prompt", + "gix-sec", + "gix-trace", + "gix-url", + "thiserror", +] + +[[package]] +name = "gix-date" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12553b32d1da25671f31c0b084bf1e5cb6d5ef529254d04ec33cdc890bd7f687" +dependencies = [ + "bstr", + "gix-error", + "itoa", + "jiff", + "smallvec", +] + +[[package]] +name = "gix-diff" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26bcd367b2c5dbf6bec9ce02ca59eab179fc82cf39f15ec83549ee25c255c99f" +dependencies = [ + "bstr", + "gix-attributes", + "gix-command", + "gix-filter", + "gix-fs", + "gix-hash", + "gix-index", + "gix-object", + "gix-path", + "gix-pathspec", + "gix-tempfile", + "gix-trace", + "gix-traverse", + "gix-worktree", + "imara-diff", + "thiserror", +] + +[[package]] +name = "gix-dir" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "004129e2c93798141d68ff08cb7f1b3d909c0212747fb8b05c8989635ba90a4e" +dependencies = [ + "bstr", + "gix-discover", + "gix-fs", + "gix-ignore", + "gix-index", + "gix-object", + "gix-path", + "gix-pathspec", + "gix-trace", + "gix-utils", + "gix-worktree", + "thiserror", +] + +[[package]] +name = "gix-discover" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "950b027b861c6863ddf1b075672ec1ef2006b95c4d12284fc1ec4cdb1ab6639e" +dependencies = [ + "bstr", + "dunce", + "gix-fs", + "gix-path", + "gix-ref", + "gix-sec", + "thiserror", +] + +[[package]] +name = "gix-error" +version = "0.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dffc9ca4dfa4f519a3d2cf1c038919160544923577ac60f45bcb602a24d82c6" +dependencies = [ + "bstr", +] + +[[package]] +name = "gix-features" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a83a5fe8927de3bb02b0cfb87165dbfb49f04d4c297767443f2e1011ecc15bdd" +dependencies = [ + "bytes", + "bytesize", + "crc32fast", + "crossbeam-channel", + "gix-path", + "gix-trace", + "gix-utils", + "libc", + "once_cell", + "parking_lot", + "prodash", + "thiserror", + "walkdir", + "zlib-rs", +] + +[[package]] +name = "gix-filter" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7240442915cdd74e1f889566695ce0d0c23c7185b13318a1232ce646af0d18ad" +dependencies = [ + "bstr", + "encoding_rs", + "gix-attributes", + "gix-command", + "gix-hash", + "gix-object", + "gix-packetline", + "gix-path", + "gix-quote", + "gix-trace", + "gix-utils", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-fs" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de4bd0d8e6c6ef03485205f8eecc0359042a866d26dba569075db1ebcc005970" +dependencies = [ + "bstr", + "fastrand", + "gix-features", + "gix-path", + "gix-utils", + "thiserror", +] + +[[package]] +name = "gix-glob" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03e6cd88cc0dc1eafa1fddac0fb719e4e74b6ea58dd016e71125fde4a326bee" +dependencies = [ + "bitflags", + "bstr", + "gix-features", + "gix-path", +] + +[[package]] +name = "gix-hash" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8ced05d2d7b13bff08b2f7eb4e47cfeaf00b974c2ddce08377c4fe1f706b3eb" +dependencies = [ + "faster-hex", + "gix-features", + "sha1-checked", + "thiserror", +] + +[[package]] +name = "gix-hashtable" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52f1eecdd006390cbed81f105417dbf82a6fe40842022006550f2e32484101da" +dependencies = [ + "gix-hash", + "hashbrown 0.16.1", + "parking_lot", +] + +[[package]] +name = "gix-ignore" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8953d87c13267e296d547f0fc7eaa8aa8fa5b2a9a34ab1cd5857f25240c7d299" +dependencies = [ + "bstr", + "gix-glob", + "gix-path", + "gix-trace", + "unicode-bom", +] + +[[package]] +name = "gix-index" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31c6b3664efe5916c539c50e610f9958f2993faf8e29fa5a40fb80b6ac8486a" +dependencies = [ + "bitflags", + "bstr", + "filetime", + "fnv", + "gix-bitmap", + "gix-features", + "gix-fs", + "gix-hash", + "gix-lock", + "gix-object", + "gix-traverse", + "gix-utils", + "gix-validate", + "hashbrown 0.16.1", + "itoa", + "libc", + "memmap2", + "rustix", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-lock" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbe09cf05ba7c679bba189acc29eeea137f643e7fff1b5dff879dfd45248be31" +dependencies = [ + "gix-tempfile", + "gix-utils", + "thiserror", +] + +[[package]] +name = "gix-mailmap" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e6fd521cb582620b7066b5b420ace1951cb84fe2241fa239b227e1a94fa25dc" +dependencies = [ + "bstr", + "gix-actor", + "gix-date", + "thiserror", +] + +[[package]] +name = "gix-negotiate" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00dff6d49869f16b8900da7c27b886a45cbf641b1e45aab355d012afe4266b7f" +dependencies = [ + "bitflags", + "gix-commitgraph", + "gix-date", + "gix-hash", + "gix-object", + "gix-revwalk", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-object" +version = "0.55.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3f705c977d90ace597049252ae1d7fec907edc0fa7616cc91bf5508d0f4006" +dependencies = [ + "bstr", + "gix-actor", + "gix-date", + "gix-features", + "gix-hash", + "gix-hashtable", + "gix-path", + "gix-utils", + "gix-validate", + "itoa", + "smallvec", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-odb" +version = "0.75.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d59882d2fdab5e609b0c452a6ef9a3bd12ef6b694be4f82ab8f126ad0969864" +dependencies = [ + "arc-swap", + "gix-features", + "gix-fs", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-pack", + "gix-path", + "gix-quote", + "parking_lot", + "tempfile", + "thiserror", +] + +[[package]] +name = "gix-pack" +version = "0.65.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c44db57ebbbeaad9972c2a60662142660427a1f0a7529314d53fefb4fedad24" +dependencies = [ + "clru", + "gix-chunk", + "gix-error", + "gix-features", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-path", + "memmap2", + "smallvec", + "thiserror", + "uluru", +] + +[[package]] +name = "gix-packetline" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25429ee1ef792d9b653ee5de09bb525489fc8e6908334cfd5d5824269f0b7073" +dependencies = [ + "bstr", + "faster-hex", + "gix-trace", + "thiserror", +] + +[[package]] +name = "gix-path" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7163b1633d35846a52ef8093f390cec240e2d55da99b60151883035e5169cd85" +dependencies = [ + "bstr", + "gix-trace", + "gix-validate", + "thiserror", +] + +[[package]] +name = "gix-pathspec" +version = "0.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7f4cc23f55ca7c190bf243f1a4e2139d4522022f724fb0dfc06c93f65a01ef6" +dependencies = [ + "bitflags", + "bstr", + "gix-attributes", + "gix-config-value", + "gix-glob", + "gix-path", + "thiserror", +] + +[[package]] +name = "gix-prompt" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4806f1ebf969cd54d178ccd975911ef1829aeccea0b27630e63c9d26c8347d7f" +dependencies = [ + "gix-command", + "gix-config-value", + "parking_lot", + "rustix", + "thiserror", +] + +[[package]] +name = "gix-protocol" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54f20837b0c70b65f6ac77886be033de3b69d5879f99128b47c42665ab0a17c2" +dependencies = [ + "bstr", + "gix-date", + "gix-features", + "gix-hash", + "gix-ref", + "gix-shallow", + "gix-transport", + "gix-utils", + "maybe-async", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-quote" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96fc2ff2ec8cc0c92807f02eab1f00eb02619fc2810d13dc42679492fcc36757" +dependencies = [ + "bstr", + "gix-utils", + "thiserror", +] + +[[package]] +name = "gix-ref" +version = "0.58.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf780dcd9ac99fd3fcfc8523479a0e2ffd55f5e0be63e5e3248fb7e46cff966" +dependencies = [ + "gix-actor", + "gix-features", + "gix-fs", + "gix-hash", + "gix-lock", + "gix-object", + "gix-path", + "gix-tempfile", + "gix-utils", + "gix-validate", + "memmap2", + "thiserror", + "winnow", +] + +[[package]] +name = "gix-refspec" +version = "0.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ce400a770a7952e45267803192cc2d1fe0afa08e2c08dde32e04c7908c6e61" +dependencies = [ + "bstr", + "gix-error", + "gix-glob", + "gix-hash", + "gix-revision", + "gix-validate", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-revision" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c719cf7d669439e1fca735bd1c4de54d43c5d30e8883fd6063c4924b213d70c9" +dependencies = [ + "bitflags", + "bstr", + "gix-commitgraph", + "gix-date", + "gix-error", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-revwalk", + "gix-trace", +] + +[[package]] +name = "gix-revwalk" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a50b30aa0c6e6de43c723359c5809a96275a3aa92d323ef7f58b1cdd60f16" +dependencies = [ + "gix-commitgraph", + "gix-date", + "gix-error", + "gix-hash", + "gix-hashtable", + "gix-object", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-sec" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e014df75f3d7f5c98b18b45c202422da6236a1c0c0a50997c3f41e601f3ad511" +dependencies = [ + "bitflags", + "gix-path", + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "gix-shallow" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "189386b5da5285216cc0ede89eff5a943d5261fc794241ee6ec5360b77df15ad" +dependencies = [ + "bstr", + "gix-hash", + "gix-lock", + "thiserror", +] + +[[package]] +name = "gix-status" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c994dbca7f038cfcde6337673523bab6e6b4f544b5046f5120a02bdeafff33" +dependencies = [ + "bstr", + "filetime", + "gix-diff", + "gix-dir", + "gix-features", + "gix-filter", + "gix-fs", + "gix-hash", + "gix-index", + "gix-object", + "gix-path", + "gix-pathspec", + "gix-worktree", + "portable-atomic", + "thiserror", +] + +[[package]] +name = "gix-submodule" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db1840fe723c6264ee596e5a179e1b9a2df59351f09bae9cea570a472a790bc0" +dependencies = [ + "bstr", + "gix-config", + "gix-path", + "gix-pathspec", + "gix-refspec", + "gix-url", + "thiserror", +] + +[[package]] +name = "gix-tempfile" +version = "21.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9ab2c89fe4bfd4f1d8700aa4516534c170d8a21ae2c554167374607c2eaf16" +dependencies = [ + "dashmap", + "gix-fs", + "libc", + "parking_lot", + "signal-hook", + "signal-hook-registry", + "tempfile", +] + +[[package]] +name = "gix-trace" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f69a13643b8437d4ca6845e08143e847a36ca82903eed13303475d0ae8b162e0" + +[[package]] +name = "gix-transport" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de1064c7ffa5a915014a6a5b71fbc5299462ae655348bed23e083b4a735076c3" +dependencies = [ + "bstr", + "gix-command", + "gix-features", + "gix-packetline", + "gix-quote", + "gix-sec", + "gix-url", + "thiserror", +] + +[[package]] +name = "gix-traverse" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37f8b53b4c56b01c43a4491c4edfe2ce66c654eb86232205172ceb1650d21c55" +dependencies = [ + "bitflags", + "gix-commitgraph", + "gix-date", + "gix-hash", + "gix-hashtable", + "gix-object", + "gix-revwalk", + "smallvec", + "thiserror", +] + +[[package]] +name = "gix-url" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d28e8af3d42581190da884f013caf254d2fd4d6ab102408f08d21bfa11de6c8d" +dependencies = [ + "bstr", + "gix-path", + "percent-encoding", + "thiserror", +] + +[[package]] +name = "gix-utils" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "befcdbdfb1238d2854591f760a48711bed85e72d80a10e8f2f93f656746ef7c5" +dependencies = [ + "bstr", + "fastrand", + "unicode-normalization", +] + +[[package]] +name = "gix-validate" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec1eff98d91941f47766367cba1be746bab662bad761d9891ae6f7882f7840b" +dependencies = [ + "bstr", +] + +[[package]] +name = "gix-worktree" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2ad658586ec0039b03e96c664f08b7cb7a2b7cca6947a9c856c9ed59b807b1" +dependencies = [ + "bstr", + "gix-attributes", + "gix-fs", + "gix-glob", + "gix-hash", + "gix-ignore", + "gix-index", + "gix-object", + "gix-path", + "gix-validate", +] + +[[package]] +name = "gix-worktree-state" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9895abc7654cbd8e102d6a765d3bdfa1567fcd5d2849b8e3d3da6405d64913c9" +dependencies = [ + "bstr", + "gix-features", + "gix-filter", + "gix-fs", + "gix-index", + "gix-object", + "gix-path", + "gix-worktree", + "io-close", + "thiserror", +] + +[[package]] +name = "gix-worktree-stream" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2339a1339413500263052a9feb866ad1847885088ed44a411b33a235dd9110c5" +dependencies = [ + "gix-attributes", + "gix-features", + "gix-filter", + "gix-fs", + "gix-hash", + "gix-object", + "gix-path", + "gix-traverse", + "parking_lot", + "thiserror", ] [[package]] @@ -352,12 +1363,63 @@ dependencies = [ "walkdir", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + [[package]] name = "httparse" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "human_format" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaec953f16e5bcf6b8a3cb3aa959b17e5577dbd2693e94554c462c08be22624b" + [[package]] name = "humansize" version = "2.1.3" @@ -391,113 +1453,6 @@ dependencies = [ "cc", ] -[[package]] -name = "icu_collections" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" -dependencies = [ - "displaydoc", - "potential_utf", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locale_core" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_normalizer" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" - -[[package]] -name = "icu_properties" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locale_core", - "icu_properties_data", - "icu_provider", - "potential_utf", - "zerotrie", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" - -[[package]] -name = "icu_provider" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" -dependencies = [ - "displaydoc", - "icu_locale_core", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerotrie", - "zerovec", -] - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - [[package]] name = "ignore" version = "0.4.23" @@ -514,6 +1469,25 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "imara-diff" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17d34b7d42178945f775e84bc4c36dde7c1c6cdfea656d3354d009056f2bb3d2" +dependencies = [ + "hashbrown 0.15.5", +] + +[[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 = "itertools" version = "0.14.0" @@ -525,18 +1499,49 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] -name = "jobserver" -version = "0.1.33" +name = "jiff" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f262f097c174adebe41eb73d66ae9c06b2844fb0da69969647bbddd9b0538a" +checksum = "1a3546dc96b6d42c5f24902af9e2538e82e39ad350b0c766eb3fbf2d8f3d8359" dependencies = [ - "getrandom 0.3.3", - "libc", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-sys 0.59.0", +] + +[[package]] +name = "jiff-static" +version = "0.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a8c8b344124222efd714b73bb41f8b5120b27a7cc1c75593a6ff768d9d05aa4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c900ef84826f1338a557697dc8fc601df9ca9af4ac137c7fb61d4c6f2dfd3076" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", ] [[package]] @@ -549,6 +1554,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kstring" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "558bf9508a558512042d3095138b1f7b8fe90c5467d94f9f1da28b3731c5dbd1" +dependencies = [ + "static_assertions", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -557,21 +1571,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.174" +version = "0.2.182" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" - -[[package]] -name = "libgit2-sys" -version = "0.18.2+1.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" [[package]] name = "libm" @@ -580,22 +1582,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] -name = "libz-sys" -version = "1.1.22" +name = "libredox" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70e7a7df205e92a1a4cd9aaae7898dac0aa555503cc0a649494d0d60e7651d" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" dependencies = [ - "cc", + "bitflags", "libc", - "pkg-config", - "vcpkg", + "plain", + "redox_syscall 0.7.3", ] [[package]] -name = "litemap" -version = "0.8.0" +name = "linux-raw-sys" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] [[package]] name = "log" @@ -603,18 +1614,38 @@ version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" +[[package]] +name = "maybe-async" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "memchr" version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" +[[package]] +name = "memmap2" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714098028fe011992e1c3962653c96b2d578c4b4bce9036e15ff220319b1e0e3" +dependencies = [ + "libc", +] + [[package]] name = "mintee" version = "0.0.1" dependencies = [ "futures", - "git2", + "gix", "httparse", "itertools", "serde", @@ -637,6 +1668,29 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.18", + "smallvec", + "windows-link 0.2.1", +] + [[package]] name = "parse-zoneinfo" version = "0.3.1" @@ -741,18 +1795,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] -name = "pkg-config" -version = "0.3.32" +name = "plain" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] -name = "potential_utf" -version = "0.1.2" +name = "portable-atomic" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" + +[[package]] +name = "portable-atomic-util" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" dependencies = [ - "zerovec", + "portable-atomic", ] [[package]] @@ -773,6 +1833,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "prodash" +version = "31.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "962200e2d7d551451297d9fdce85138374019ada198e30ea9ede38034e27604c" +dependencies = [ + "bytesize", + "human_format", + "parking_lot", +] + [[package]] name = "quote" version = "1.0.40" @@ -819,10 +1890,28 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.11.1" +name = "redox_syscall" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_syscall" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -832,9 +1921,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -847,6 +1936,19 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + [[package]] name = "rustversion" version = "1.0.22" @@ -869,19 +1971,35 @@ dependencies = [ ] [[package]] -name = "serde" -version = "1.0.219" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -900,6 +2018,27 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha1-checked" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89f599ac0c323ebb1c6082821a54962b839832b03984598375bff3975b804423" +dependencies = [ + "digest", + "sha1", +] + [[package]] name = "sha2" version = "0.10.9" @@ -911,12 +2050,38 @@ dependencies = [ "digest", ] +[[package]] +name = "shell-words" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77" + [[package]] name = "shlex" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "signal-hook" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b57709da74f9ff9f4a27dce9526eec25ca8407c45a7887243b031a58935fb8e" +dependencies = [ + "libc", + "signal-hook-registry", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + [[package]] name = "siphasher" version = "1.0.1" @@ -951,6 +2116,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "syn" version = "2.0.104" @@ -963,14 +2134,16 @@ dependencies = [ ] [[package]] -name = "synstructure" -version = "0.13.2" +name = "tempfile" +version = "3.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +checksum = "82a72c767771b47409d2345987fda8628641887d5466101319899796367354a0" dependencies = [ - "proc-macro2", - "quote", - "syn", + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", ] [[package]] @@ -997,18 +2170,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -1016,15 +2189,20 @@ dependencies = [ ] [[package]] -name = "tinystr" -version = "0.8.1" +name = "tinyvec" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" dependencies = [ - "displaydoc", - "zerovec", + "tinyvec_macros", ] +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "typed-path" version = "0.12.3" @@ -1043,6 +2221,15 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" +[[package]] +name = "uluru" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c8a2469e56e6e5095c82ccd3afb98dad95f7af7929aab6d8ba8d6e0f73657da" +dependencies = [ + "arrayvec", +] + [[package]] name = "unic-char-property" version = "0.9.0" @@ -1093,6 +2280,12 @@ dependencies = [ "unic-common", ] +[[package]] +name = "unicode-bom" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eec5d1121208364f6793f7d2e222bf75a915c19557537745b195b253dd64217" + [[package]] name = "unicode-ident" version = "1.0.18" @@ -1100,28 +2293,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] -name = "url" -version = "2.5.4" +name = "unicode-normalization" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", + "tinyvec", ] -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -1211,15 +2390,37 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + [[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.61.2" @@ -1228,7 +2429,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -1261,13 +2462,19 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-result" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1276,7 +2483,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -1288,6 +2495,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -1352,6 +2568,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + [[package]] name = "wit-bindgen-rt" version = "0.39.0" @@ -1361,36 +2586,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "writeable" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" - -[[package]] -name = "yoke" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.8.26" @@ -1412,55 +2607,7 @@ dependencies = [ ] [[package]] -name = "zerofrom" -version = "0.1.6" +name = "zlib-rs" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerotrie" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", -] - -[[package]] -name = "zerovec" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa2bd55086f1ab526693ecbe444205da57e25f4489879da80635a46d90e73b" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513" diff --git a/Cargo.toml b/Cargo.toml index c0a6d3f..65fd9b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,9 @@ name = "frontend" [[bin]] name = "test_render" -path = "src/test-render.rs" [dependencies] -git2 = { version = "0.20.2", default-features = false } +gix = "0.78.0" serde = { version = "1.0.219", default-features = false, features = ["derive"] } #inkjet = "0.11.1" #markdown = "1.0.0" diff --git a/src/backend/git.rs b/src/backend/git.rs new file mode 100644 index 0000000..9e269ab --- /dev/null +++ b/src/backend/git.rs @@ -0,0 +1,69 @@ +use std::error::Error; + +use gix::{ Repository, traverse::tree::Recorder, prelude::* }; +use serde::Serialize; +use tera::Context; + +#[derive(Serialize)] +struct Entry { + class: u16, + last_commit: String, + last_commit_message: String, + last_commit_time: String, + path: String, +} + +pub fn repo_to_context(r: Repository) -> Result> { + let mut entries = Vec::new(); + + let branches = r.clone().branch_names() + .iter() + .map(|x| x.to_owned().to_owned()) + .collect::>(); + + let tree = r.rev_parse_single("@")?.object()?.peel_to_tree()?; + + /* replace with configurable branch name when we have a database */ + let current_branch = r.head()?.referent_name().unwrap().to_string(); + + //tree.traverse().breadthfirst(&mut rec)?; + for e in tree.iter() { + let entry = e.unwrap(); + + let last_commit = "TODO".to_string(); + let last_commit_message = "TODO".to_string(); + let last_commit_time = "1970-01-01T00:00:00".to_string(); + + entries.push(Entry { + class: entry.kind() as u16, + last_commit, + last_commit_message, + last_commit_time, + path: entry.filename().to_string(), + }); + } + + let dir = r.git_dir(); + let name = dir.file_name().unwrap().to_str().unwrap(); + let directory = dir.as_os_str().to_str().unwrap(); + + let mut ctx = Context::new(); + + /* stubs til we have a real database */ + ctx.insert("user", "anon"); + ctx.insert("site", "TiB."); + ctx.insert("notif_count", ""); + ctx.insert("ticket_count", "(47)"); + + ctx.insert("readme_content", "test readme"); + + ctx.insert("branches", &branches); + ctx.insert("entries", &entries); + ctx.insert("owner", "anon"); + ctx.insert("branch", ¤t_branch); + ctx.insert("repo", name); + ctx.insert("directory", directory); + ctx.insert("entries", &entries); + + Ok(ctx) +} diff --git a/src/backend/mod.rs b/src/backend/mod.rs new file mode 100644 index 0000000..c68a506 --- /dev/null +++ b/src/backend/mod.rs @@ -0,0 +1,2 @@ +pub mod git; +pub mod render; diff --git a/src/render.rs b/src/backend/render.rs similarity index 100% rename from src/render.rs rename to src/backend/render.rs diff --git a/src/backend/test.rs b/src/backend/test.rs new file mode 100644 index 0000000..6cbc766 --- /dev/null +++ b/src/backend/test.rs @@ -0,0 +1,25 @@ +use std::{ env::current_dir, error::Error }; + +use gix::{ traverse::tree::Recorder, prelude::* }; + +fn main() -> Result<(), Box> { + let r = gix::open(current_dir()?)?; + + let mut rec = Recorder::default(); + + let tree = r.rev_parse_single("@")?.object()?.peel_to_tree()?; + + tree.traverse().breadthfirst(&mut rec)?; + + for e in rec.records.iter() { + println!("{}", e.filepath) + } + + /* + for e in tree.iter() { + println!("{}", e?.filename()) + } + */ + + Ok(()) +} diff --git a/src/bin/backend/git.rs b/src/bin/backend/git.rs new file mode 100644 index 0000000..01af3f1 --- /dev/null +++ b/src/bin/backend/git.rs @@ -0,0 +1,62 @@ +use std::error::Error; + +use gix::{ Repository, traverse::tree::Recorder, prelude::* }; +use serde::Serialize; +use tera::Context; + +#[derive(Serialize)] +struct Entry { + mode: String, + hash: String, + path: String, +} + +pub fn repo_to_context(r: Repository) -> Result> { + let mut entries = Vec::new(); + + let branches = r.clone().branch_names() + .iter() + .map(|x| x.to_owned().to_owned()) + .collect::>(); + + let mut rec = Recorder::default(); + + let tree = r.rev_parse_single("@")?.object()?.peel_to_tree()?; + + /* replace with configurable branch name when we have a database */ + let current_branch = r.head()?.referent_name().unwrap().to_string(); + + tree.traverse().breadthfirst(&mut rec)?; + + for e in rec.records.iter() { + entries.push(Entry { + mode: e.mode.value().to_string(), + hash: e.oid.to_string(), + path: e.filepath.to_string(), + }); + } + + let dir = r.git_dir(); + let name = dir.file_name().unwrap().to_str().unwrap(); + let directory = dir.as_os_str().to_str().unwrap(); + + let mut ctx = Context::new(); + + /* stubs til we have a real database */ + ctx.insert("user", "anon"); + ctx.insert("site", "TiB."); + ctx.insert("notif_count", ""); + ctx.insert("ticket_count", "(47)"); + + ctx.insert("readme_content", "test readme"); + + ctx.insert("branches", &branches); + ctx.insert("entries", &entries); + ctx.insert("owner", "anon"); + ctx.insert("branch", ¤t_branch); + ctx.insert("repo", name); + ctx.insert("directory", directory); + ctx.insert("entries", &entries); + + Ok(ctx) +} diff --git a/src/bin/backend/render.rs b/src/bin/backend/render.rs new file mode 100644 index 0000000..58bba25 --- /dev/null +++ b/src/bin/backend/render.rs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2025 Emma Tebibyte + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Mintee. + * + * Mintee is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * Mintee is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Mintee. If not, see https://www.gnu.org/licenses/. + */ + +use std::{ + error::Error, + fmt::{ self, Display, Formatter }, + path::Path, +}; + +use tera::{ Context, Tera }; + +#[non_exhaustive] +pub enum PageKind { + Code, + Dashboard, + Tickets, + User, +} + +impl PageKind { + pub fn render_page(&self, ctx: Context) -> Result> { + let page_dir = self.to_string(); + let template = String::from_utf8(Path::new(&page_dir) + .to_path_buf() + .as_mut_os_string() + .as_encoded_bytes() + .to_vec() + )?; + + let tera = Tera::new(&page_dir)?; + Ok(tera.render(&template, &ctx)?) + } +} + +impl Display for PageKind { + fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), fmt::Error> { + use PageKind::*; + + let path = match self { + Code => "repo/code.html", + Dashboard => "dashboard.html", + Tickets => "repo/tickets.html", + User => "user.html", + }; + + write!(f, "./assets/templates/{}", path) + } +} diff --git a/src/test-render.rs b/src/bin/backend/test-render.rs similarity index 86% rename from src/test-render.rs rename to src/bin/backend/test-render.rs index 6332b45..e3c2fda 100644 --- a/src/test-render.rs +++ b/src/bin/backend/test-render.rs @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Emma Tebibyte + * Copyright (c) 2025–2026 Emma Tebibyte * SPDX-License-Identifier: AGPL-3.0-or-later * * This file is part of Mintee. @@ -23,23 +23,14 @@ use std::{ error::Error, }; -use serde::Serialize; +use gix::open; use tera::{ Context, Tera }; -#[path="git.rs"] mod git; -use git::GitRepo; - -#[derive(Serialize)] -struct SampleEntry { - class: String, - last_commit_message: String, - last_commit: String, - last_commit_time: i64, - path: String, -} +use git::repo_to_context; +/* impl From for Context { fn from(repo: GitRepo) -> Self { let mut ctx = Context::new(); @@ -85,13 +76,12 @@ impl From for Context { ctx } } +*/ fn main() -> Result<(), Box> { if let Some(templates) = args().collect::>().get(1) { let tera = Tera::new(templates.as_str())?; - let ctx = Context::from( - GitRepo::open(current_dir()?.to_path_buf(), None)? - ); + let ctx = repo_to_context(open(current_dir()?)?)?; println!("{}", tera.render("code.html", &ctx)?); diff --git a/src/bin/backend/test.rs b/src/bin/backend/test.rs new file mode 100644 index 0000000..6cbc766 --- /dev/null +++ b/src/bin/backend/test.rs @@ -0,0 +1,25 @@ +use std::{ env::current_dir, error::Error }; + +use gix::{ traverse::tree::Recorder, prelude::* }; + +fn main() -> Result<(), Box> { + let r = gix::open(current_dir()?)?; + + let mut rec = Recorder::default(); + + let tree = r.rev_parse_single("@")?.object()?.peel_to_tree()?; + + tree.traverse().breadthfirst(&mut rec)?; + + for e in rec.records.iter() { + println!("{}", e.filepath) + } + + /* + for e in tree.iter() { + println!("{}", e?.filename()) + } + */ + + Ok(()) +} diff --git a/src/bin/test_render.rs b/src/bin/test_render.rs new file mode 100644 index 0000000..d0a5dec --- /dev/null +++ b/src/bin/test_render.rs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025–2026 Emma Tebibyte + * SPDX-License-Identifier: AGPL-3.0-or-later + * + * This file is part of Mintee. + * + * Mintee is free software: you can redistribute it and/or modify it under the + * terms of the GNU Affero General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) + * any later version. + * + * Mintee is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Mintee. If not, see https://www.gnu.org/licenses/. + */ + +use std::{ + env::{ args, current_dir }, + error::Error, +}; + +use gix::open; +use tera::{ Context, Tera }; + +use mintee::backend::git::repo_to_context; + +/* +impl From for Context { + fn from(repo: GitRepo) -> Self { + let mut ctx = Context::new(); + + let directory = format!("{}/{}", repo.owner, repo.name); + + let main_branch = repo.branches + .iter() + .find(|b| b.name == "main") + .unwrap(); + + let latest_commit = &main_branch.commits[0]; + let hash = latest_commit.hash.clone(); + + let mut entries = Vec::new(); + + for e in latest_commit.entries.iter() { + let entry = SampleEntry { + class: e.kind.to_string(), + last_commit: hash.clone(), + last_commit_message: latest_commit.message.clone().unwrap(), + last_commit_time: latest_commit.time, + path: e.path.clone(), + }; + + entries.push(entry); + } + + /* stubs til we have a real database */ + ctx.insert("user", "anon"); + ctx.insert("site", "TiB."); + ctx.insert("notif_count", ""); + ctx.insert("ticket_count", "(47)"); + + ctx.insert("readme_content", "this is a readme"); + + ctx.insert("owner", &repo.owner); + ctx.insert("branch", &main_branch.name); + ctx.insert("repo", &repo.name); + ctx.insert("directory", &directory); + ctx.insert("entries", &entries); + + ctx + } +} +*/ + +fn main() -> Result<(), Box> { + if let Some(templates) = args().collect::>().get(1) { + let tera = Tera::new(templates.as_str())?; + let ctx = repo_to_context(open(current_dir()?)?)?; + + println!("{}", tera.render("code.html", &ctx)?); + + Ok(()) + } else { + eprintln!("Usage: {} template_glob", args().collect::>()[0]); + std::process::exit(64); + } +} diff --git a/src/git.rs b/src/git.rs deleted file mode 100644 index 88d9729..0000000 --- a/src/git.rs +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2025 Emma Tebibyte - * SPDX-License-Identifier: AGPL-3.0-or-later - * - * This file is part of Mintee. - * - * Mintee is free software: you can redistribute it and/or modify it under the - * terms of the GNU Affero General Public License as published by the Free - * Software Foundation, either version 3 of the License, or (at your option) - * any later version. - * - * Mintee is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more - * details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Mintee. If not, see https://www.gnu.org/licenses/. - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * MIT License - * - * Copyright (c) 2021 Sergey "Shnatsel" Davidoff - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -use std::{ - error::Error, - path::PathBuf, -}; - -use git2::{ Branch, Commit, FileMode, Repository, Sort, TreeEntry }; -use tera::Context; - -/* TODO: implement From for Context where T: all Git* types */ - -pub enum GitEntryKind { - Directory, - File, - Link, -} - -impl ToString for GitEntryKind { - fn to_string(&self) -> String { - match self { - GitEntryKind::Directory => "directory".to_owned(), - GitEntryKind::File => "file".to_owned(), - GitEntryKind::Link => "link".to_owned(), - } - } -} - -pub struct GitEntry { - pub entries: Vec, - pub kind: GitEntryKind, - pub path: String, -} - -impl GitEntry { - fn new(entries: Vec, kind: GitEntryKind, path: String) -> Self { - GitEntry { entries, kind, path } - } -} - -impl TryFrom> for GitEntry { - type Error = std::string::FromUtf8Error; - - fn try_from(entry: TreeEntry) -> Result { - let entries = Vec::new(); - let path = String::from_utf8(entry.name_bytes().to_vec())?; - let kind = match entry.filemode() { - m if m == ::from(FileMode::Blob) => GitEntryKind::File, - m if m == ::from(FileMode::BlobExecutable) => GitEntryKind::File, - m if m == ::from(FileMode::BlobGroupWritable) => unreachable!(), - m if m == ::from(FileMode::Link) => GitEntryKind::File, - m if m == ::from(FileMode::Tree) => GitEntryKind::Directory, - m if m == ::from(FileMode::Commit) => GitEntryKind::File, - m if m == ::from(FileMode::Unreadable) => todo!(), - _ => GitEntryKind::Directory, - }; - - Ok(Self::new(entries, kind, path)) - } -} - -pub struct GitCommit { - pub author: (Option, Option), // name, e-mail - pub entries: Vec, - pub hash: String, - pub message: Option, - pub short_hash: Option, - pub time: i64, // seconds since Unix epoch -} - -impl From for Context { - fn from(value: GitCommit) -> Self { - let mut ctx = Context::new(); - - todo!("proc_macro for populating"); - - ctx - } -} - -impl TryFrom> for GitCommit { - type Error = Box; - - fn try_from(commit: Commit) -> Result { - let hash = commit.id().to_string(); - let short_hash = commit.as_object().short_id()?.as_str().map(|f| f.to_owned()); - let message = commit.message().map(|f| f.to_owned()); - let commit_signature = commit.author(); - let name = commit_signature.name().map(|f| f.to_owned()); - let address = commit_signature.email().map(|f| f.to_owned()); - let author = (name, address); - let time = commit.time().seconds(); - let entries = commit - .tree()? - .iter() - .map(|c| -> Result { - Ok(GitEntry::try_from(c)?) - }).collect::, _>>()?; - - Ok(GitCommit { author, entries, hash, message, short_hash, time }) - } -} - -pub struct GitBranch { - pub commits: Vec, - pub name: String, -} - -struct GitBranchWrapper<'a> { - branch: Branch<'a>, - repo: &'a Repository, -} - -impl<'a> GitBranchWrapper<'a> { - fn new(branch: Branch<'a>, repo: &'a Repository) -> Self { - Self { branch, repo } - } -} - -impl TryFrom> for GitBranch { - type Error = Box; - - fn try_from(branch: GitBranchWrapper) -> Result { - let name = String::from_utf8(branch.branch.name_bytes()?.to_vec())?; - let repo = branch.repo; - let branch_oid = branch.branch.get().resolve()?.target().unwrap(); - - let mut revwalk = repo.revwalk()?; - revwalk.set_sorting(Sort::TOPOLOGICAL | Sort::TIME)?; - revwalk.push(branch_oid)?; - - let commits = revwalk - .into_iter() - .map(|o| -> Result> { - Ok(GitCommit::try_from(repo.find_commit(o?)?)?) - }).collect::, _>>()?; - - Ok(GitBranch { commits, name }) - } - -} - -pub struct GitRepo { - pub branches: Vec, - pub name: String, - pub owner: String, -} - -impl GitRepo { - pub fn open( - path: PathBuf, prefix: Option - ) -> Result> { - let repo = Repository::open(path.clone())?; - - let branches = repo - .branches(None)? - .map(|b| -> Result> { - Ok(GitBranch::try_from(GitBranchWrapper::new(b?.0, &repo))?) - }).collect::, _>>()?; - /* - let mut revwalk = repo.revwalk()?; - - revwalk.set_sorting(Sort::TOPOLOGICAL | Sort::TIME)?; - revwalk.push_head()?; - let commits = revwalk - .into_iter() - .map(|o| -> Result> { - Ok(GitCommit::try_from(repo.find_commit(o?)?)?) - }).collect::, _>>()?; - */ - - let full_path = path.clone().as_path().canonicalize()?; - let relative_path = match prefix { - Some(p) => full_path.strip_prefix(p)?.canonicalize()?, - None => full_path, - }; - - let owner = String::from_utf8( - relative_path - .parent() - .unwrap() - .to_path_buf() - .as_mut_os_string() - .as_encoded_bytes() - .to_vec() - )?; - - let name = String::from_utf8( - relative_path - .file_name() - .unwrap() - .to_owned() - .as_encoded_bytes() - .to_vec() - )?; - - Ok(GitRepo { branches, name, owner }) - } - - pub fn get_remote_repo() { // for AP repos - todo!(); - } -} diff --git a/src/lib.rs b/src/lib.rs index 812d1ed..af44cfd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1,2 @@ +pub mod backend; pub mod util;