From cad0c71abe5a98eecc81cee72054e307d0c71c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Tue, 25 Nov 2025 19:22:03 +0100 Subject: [PATCH 1/2] Use gix_repo in get_tags --- asyncgit/src/sync/tags.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/asyncgit/src/sync/tags.rs b/asyncgit/src/sync/tags.rs index f2193b2193..f8c275ada0 100644 --- a/asyncgit/src/sync/tags.rs +++ b/asyncgit/src/sync/tags.rs @@ -1,5 +1,8 @@ use super::{get_commits_info, CommitId, RepoPath}; -use crate::{error::Result, sync::repository::repo}; +use crate::{ + error::Result, + sync::{gix_repo, repository::repo}, +}; use scopetime::scope_time; use std::collections::{BTreeMap, HashMap, HashSet}; @@ -58,10 +61,8 @@ pub fn get_tags(repo_path: &RepoPath) -> Result { } }; - let gix_repo: gix::Repository = - gix::ThreadSafeRepository::discover_with_environment_overrides(repo_path.gitpath()) - .map(Into::into)?; - let platform = gix_repo.references()?; + let repo: gix::Repository = gix_repo(repo_path)?; + let platform = repo.references()?; for mut reference in (platform.tags()?).flatten() { let commit = reference.peel_to_commit(); let tag = reference.peel_to_tag(); From 3b48e1fc480181fa5e9342efe5a7cd4adb202ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20R=C3=BC=C3=9Fler?= Date: Tue, 25 Nov 2025 19:20:11 +0100 Subject: [PATCH 2/2] Take workdir into account in gix_repo --- Cargo.lock | 130 +++++++++++++------------------- asyncgit/Cargo.toml | 2 +- asyncgit/src/sync/repository.rs | 6 +- asyncgit/src/sync/status.rs | 1 - 4 files changed, 60 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f4823f279e..da03ce578c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1221,9 +1221,9 @@ dependencies = [ [[package]] name = "gix" -version = "0.74.1" +version = "0.75.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd3a6fea165debe0e80648495f894aa2371a771e3ceb7a7dcc304f1c4344c43" +checksum = "60beff35667fb0ac935c4c45941868d9cf5025e4b85c58deb3c5a65113e22ce4" dependencies = [ "gix-actor", "gix-attributes", @@ -1271,9 +1271,9 @@ dependencies = [ [[package]] name = "gix-actor" -version = "0.35.6" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "987a51a7e66db6ef4dc030418eb2a42af6b913a79edd8670766122d8af3ba59e" +checksum = "694f6c16eb88b16b00b1d811e4e4bda6f79e9eb467a1b04fd5b848da677baa81" dependencies = [ "bstr", "gix-date", @@ -1346,9 +1346,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.47.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e74f57ea99025de9207db53488be4d59cf2000f617964c1b550880524fefbc3" +checksum = "9419284839421488b5ab9b9b88386bdc1e159a986c08e17ffa3e9a5cd2b139f5" dependencies = [ "bstr", "gix-config-value", @@ -1379,9 +1379,9 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.10.7" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "661245d045aa7c16ba4244daaabd823c562c3e45f1f25b816be2c57ee09f2171" +checksum = "9f94626a5bc591a57025361a3a890092469e47c7667e59fc143439cd6eaf47fe" dependencies = [ "bstr", "itoa", @@ -1392,9 +1392,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd78d9da421baca219a650d71c797706117095635d7963f21bb6fdf2410abe04" +checksum = "cfc7735ca267da78c37e916e9b32d67b0b0e3fc9401378920e9469b5d497dccf" dependencies = [ "bstr", "gix-attributes", @@ -1416,9 +1416,9 @@ dependencies = [ [[package]] name = "gix-dir" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99fb4dcba076453d791949bf3af977c5678a1cbd76740ec2cfe37e29431daf3" +checksum = "cb9a55642e31c81d235e6ab2a7f00343c0f79e70973245a8a1e1d16c498e3e86" dependencies = [ "bstr", "gix-discover", @@ -1436,9 +1436,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.42.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d24547153810634636471af88338240e6ab0831308cd41eb6ebfffea77811c6" +checksum = "809f8dba9fbd7a054894ec222815742b96def1ca08e18c38b1dbc1f737dd213d" dependencies = [ "bstr", "dunce", @@ -1472,9 +1472,9 @@ dependencies = [ [[package]] name = "gix-filter" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1253452c9808da01eaaf9b1c4929b9982efec29ef0a668b3326b8046d9b8fb" +checksum = "9e137e7df1ae40fe2b49dcb2845c6bf7ac04cd53a320d72e761c598a6fd452ed" dependencies = [ "bstr", "encoding_rs", @@ -1482,7 +1482,7 @@ dependencies = [ "gix-command", "gix-hash", "gix-object", - "gix-packetline-blocking", + "gix-packetline", "gix-path", "gix-quote", "gix-trace", @@ -1555,9 +1555,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.42.1" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31244542fb98ea4f3e964a4f8deafc2f4c77ad42bed58a1e8424bca1965fae99" +checksum = "eab6410318b98750883eb3e35eb999abfb155b407eb0580726d4d868b60cde04" dependencies = [ "bitflags 2.10.0", "bstr", @@ -1594,9 +1594,9 @@ dependencies = [ [[package]] name = "gix-mailmap" -version = "0.27.4" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3fc0f07ce86acc94d93e5d10ef38bad322dede2622d5ff84f0799ac13b7e7d" +checksum = "2a97041c66c8b6c2f34cf6b8585a36e28a07401a611a69d8a5d2cee0eea2aa72" dependencies = [ "bstr", "gix-actor", @@ -1606,9 +1606,9 @@ dependencies = [ [[package]] name = "gix-object" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba1815638759c80d2318c8e98296fb396f577c2e588a3d9c13f9a5d5184051" +checksum = "84743d1091c501a56f00d7f4c595cb30f20fcef6503b32ac0a1ff3817efd7b5d" dependencies = [ "bstr", "gix-actor", @@ -1627,9 +1627,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.71.1" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6efc6736d3ea62640efe8c1be695fb0760af63614a7356d2091208a841f1a634" +checksum = "5f81b480252f3a4d55f87e6e358c4c6f7615f98b1742e1e70118c57282a92e82" dependencies = [ "arc-swap", "gix-date", @@ -1648,9 +1648,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.61.1" +version = "0.62.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719c60524be76874f4769da20d525ad2c00a0e7059943cc4f31fcb65cfb6b260" +checksum = "38e868463538731a0fd99f3950637957413bbfbe69143520c0b5c1e163303577" dependencies = [ "clru", "gix-chunk", @@ -1667,21 +1667,9 @@ dependencies = [ [[package]] name = "gix-packetline" -version = "0.19.3" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64286a8b5148e76ab80932e72762dd27ccf6169dd7a134b027c8a262a8262fcf" -dependencies = [ - "bstr", - "faster-hex", - "gix-trace", - "thiserror", -] - -[[package]] -name = "gix-packetline-blocking" -version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89c59c3ad41e68cb38547d849e9ef5ccfc0d00f282244ba1441ae856be54d001" +checksum = "fad0ffb982a289888087a165d3e849cbac724f2aa5431236b050dd2cb9c7de31" dependencies = [ "bstr", "faster-hex", @@ -1691,14 +1679,13 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.21" +version = "0.10.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0416b41cd00ff292af9b94b0660880c44bd2ed66828ddca9a2b333535cbb71b8" +checksum = "7cb06c3e4f8eed6e24fd915fa93145e28a511f4ea0e768bae16673e05ed3f366" dependencies = [ "bstr", "gix-trace", "gix-validate", - "home", "thiserror", ] @@ -1719,9 +1706,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.52.1" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f19873bbf924fd077580d4ccaaaeddb67c3b3c09a8ffb61e6b4cb67e3c9302" +checksum = "6947d3b919ec8d10738f4251905a8485366ffdd24942cdbe9c6b69376bf57d64" dependencies = [ "bstr", "gix-date", @@ -1749,9 +1736,9 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.54.1" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8881d262f28eda39c244e60ae968f4f6e56c747f65addd6f4100b25f75ed8b88" +checksum = "e51330a32f173c8e831731dfef8e93a748c23c057f4b028841f222564cad84cb" dependencies = [ "gix-actor", "gix-features", @@ -1770,11 +1757,12 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93147960f77695ba89b72019b789679278dd4dad6a0f9a4a5bf2fd07aba56912" +checksum = "7f88233214a302d61e60bb9d1387043c1759b761dba4a8704b341fecbf6b1266" dependencies = [ "bstr", + "gix-glob", "gix-hash", "gix-revision", "gix-validate", @@ -1784,9 +1772,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.36.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c5267e530d8762842be7d51b48d2b134c9dec5b650ca607f735a56a4b12413" +checksum = "ffe7f489bd27e7e388885210bc189088012db6062ccc75d713d1cef8eff56883" dependencies = [ "bitflags 2.10.0", "bstr", @@ -1802,9 +1790,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2de4f91d712b1f6873477f769225fe430ffce2af8c7c85721c3ff955783b3" +checksum = "dd2fae8449d97fb92078c46cb63544e0024955f43738a610d24277a3b01d5a00" dependencies = [ "gix-commitgraph", "gix-date", @@ -1841,9 +1829,9 @@ dependencies = [ [[package]] name = "gix-status" -version = "0.21.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c64039358f66c955a471432aef0ea1eeebc7afe0e0a4be7b6b737cc19925e3b" +checksum = "53c9ad16b4d9da73d527eb6d1be05de9e0641855b8084b362dd657255684f81f" dependencies = [ "bstr", "filetime", @@ -1864,9 +1852,9 @@ dependencies = [ [[package]] name = "gix-submodule" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bacc06333b50abc4fc06204622c2dd92850de2066bb5d421ac776d2bef7ae55" +checksum = "2b79f64c669d8578f45046b3ffb8d4d9cc4beb798871ff638a7b5c1f59dbd2fc" dependencies = [ "bstr", "gix-config", @@ -1898,9 +1886,9 @@ checksum = "1d3f59a8de2934f6391b6b3a1a7654eae18961fcb9f9c843533fed34ad0f3457" [[package]] name = "gix-transport" -version = "0.49.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8da4a77922accb1e26e610c7a84ef7e6b34fd07112e6a84afd68d7f3e795957" +checksum = "e058d6667165dba7642b3c293d7c355e2a964acef9bc9408604547d952943a8f" dependencies = [ "bstr", "gix-command", @@ -1914,9 +1902,9 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.48.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "412126bade03a34f5d4125fd64878852718575b3b360eaae3b29970cb555e2a2" +checksum = "054c79f4c3f87e794ff7dc1fec8306a2bb563cfb38f6be2dc0e4c0fa82f74d59" dependencies = [ "bitflags 2.10.0", "gix-commitgraph", @@ -1931,16 +1919,15 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.33.1" +version = "0.33.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79b07b48dd9285485eb10429696ddcd1bfe6fb942ec0e5efb401ae7e40238e5" +checksum = "d995249a1cf1ad79ba10af6499d4bf37cb78035c0983eaa09ec5910da694957c" dependencies = [ "bstr", "gix-features", "gix-path", "percent-encoding", "thiserror", - "url", ] [[package]] @@ -1966,9 +1953,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.43.1" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df3dfc8b62b0eccc923c757b40f488abc357c85c03d798622edfc3eb5137e04" +checksum = "428e8928e0e27341b58aa89e20adaf643efd6a8f863bc9cdf3ec6199c2110c96" dependencies = [ "bstr", "gix-attributes", @@ -2056,15 +2043,6 @@ dependencies = [ "digest", ] -[[package]] -name = "home" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "iana-time-zone" version = "0.1.61" diff --git a/asyncgit/Cargo.toml b/asyncgit/Cargo.toml index f1d5bb1878..955d130cba 100644 --- a/asyncgit/Cargo.toml +++ b/asyncgit/Cargo.toml @@ -24,7 +24,7 @@ easy-cast = "0.5" fuzzy-matcher = "0.3" git2 = "0.20" git2-hooks = { path = "../git2-hooks", version = ">=0.5" } -gix = { version = "0.74.1", default-features = false, features = [ +gix = { version = "0.75.0", default-features = false, features = [ "max-performance", "revision", "mailmap", diff --git a/asyncgit/src/sync/repository.rs b/asyncgit/src/sync/repository.rs index 5c11abdbf4..c49795fb7c 100644 --- a/asyncgit/src/sync/repository.rs +++ b/asyncgit/src/sync/repository.rs @@ -69,10 +69,14 @@ pub fn repo(repo_path: &RepoPath) -> Result { } pub fn gix_repo(repo_path: &RepoPath) -> Result { - let repo = gix::ThreadSafeRepository::discover_with_environment_overrides( + let mut repo: gix::Repository = gix::ThreadSafeRepository::discover_with_environment_overrides( repo_path.gitpath(), ) .map(Into::into)?; + if let Some(workdir) = repo_path.workdir() { + repo.set_workdir(Some(workdir.into()))?; + } + Ok(repo) } diff --git a/asyncgit/src/sync/status.rs b/asyncgit/src/sync/status.rs index 3cd855ce07..74843539d6 100644 --- a/asyncgit/src/sync/status.rs +++ b/asyncgit/src/sync/status.rs @@ -297,7 +297,6 @@ mod tests { }; #[test] - #[should_panic] fn test_get_status_with_workdir() { let (git_dir, _repo) = repo_init_bare().unwrap();