diff --git a/Cargo.lock b/Cargo.lock index 1b4892e77..08d6b9036 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1036,9 +1036,9 @@ dependencies = [ [[package]] name = "gix" -version = "0.56.0" +version = "0.57.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0dcdc9c60d66535897fa40a7ea2a635e72f99456b1d9ae86b7e170e80618cb" +checksum = "6dd025382892c7b500a9ce1582cd803f9c2ebfe44aff52e9c7f86feee7ced75e" dependencies = [ "gix-actor", "gix-commitgraph", @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "gix-actor" -version = "0.28.1" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eadca029ef716b4378f7afb19f7ee101fde9e58ba1f1445971315ac866db417" +checksum = "da27b5ab4ab5c75ff891dccd48409f8cc53c28a79480f1efdd33184b2dc1d958" dependencies = [ "bstr", "btoi", @@ -1092,27 +1092,27 @@ dependencies = [ [[package]] name = "gix-bitmap" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d49e1a13a30d3f88be4bceae184dd13a2d3fb9ffa7515f7ed7ae771b857f4916" +checksum = "78b6cd0f246180034ddafac9b00a112f19178135b21eb031b3f79355891f7325" dependencies = [ "thiserror", ] [[package]] name = "gix-chunk" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d411ecd9b558b0c20b3252b7e409eec48eabc41d18324954fe526bac6e2db55f" +checksum = "003ec6deacf68076a0c157271a127e0bb2c031c1a41f7168cbe5d248d9b85c78" dependencies = [ "thiserror", ] [[package]] name = "gix-commitgraph" -version = "0.22.1" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7007ba021f059803afaf6f8a48872422abc20550ac12ede6ddea2936cec36" +checksum = "8a39c675fd737cb43a2120eddf1aa652c19d76b28d79783a198ac1b398ed9ce6" dependencies = [ "bstr", "gix-chunk", @@ -1124,9 +1124,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.32.1" +version = "0.33.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0341471d55d8676e98b88e121d7065dfa4c9c5acea4b6d6ecdd2846e85cce0c3" +checksum = "367304855b369cadcac4ee5fb5a3a20da9378dd7905106141070b79f85241079" dependencies = [ "bstr", "gix-config-value", @@ -1145,9 +1145,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6419db582ea84dfb58c7e7b0af7fd62c808aa14954af2936a33f89b0f4ed018e" +checksum = "52e0be46f4cf1f8f9e88d0e3eb7b29718aff23889563249f379119bd1ab6910e" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1158,9 +1158,9 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "468dfbe411f335f01525a1352271727f8e7772075a93fa747260f502086b30be" +checksum = "fb7f3dfb72bebe3449b5e642be64e3c6ccbe9821c8b8f19f487cf5bfbbf4067e" dependencies = [ "bstr", "itoa", @@ -1170,9 +1170,9 @@ dependencies = [ [[package]] name = "gix-diff" -version = "0.38.0" +version = "0.39.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8119a985887cfe68f4bdf92e51bd64bc758a73882d82fcfc03ebcb164441c85d" +checksum = "fd6a0454f8c42d686f17e7f084057c717c082b7dbb8209729e4e8f26749eb93a" dependencies = [ "bstr", "gix-hash", @@ -1182,9 +1182,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.27.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fad89416ebe0b3b7df78464124e2a02417b6cd3743d48ad93df86f4d2929c07" +checksum = "b8d7b2896edc3d899d28a646ccc6df729827a6600e546570b2783466404a42d6" dependencies = [ "bstr", "dunce", @@ -1197,9 +1197,9 @@ dependencies = [ [[package]] name = "gix-features" -version = "0.36.1" +version = "0.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d46a4a5c6bb5bebec9c0d18b65ada20e6517dbd7cf855b87dd4bbdce3a771b2" +checksum = "77a80f0fe688d654c2a741751578b11131071026d1934d03c1820d6d767525ce" dependencies = [ "crc32fast", "crossbeam-channel", @@ -1219,18 +1219,18 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20e86eb040f5776a5ade092282e51cdcad398adb77d948b88d17583c2ae4e107" +checksum = "7555c23a005537434bbfcb8939694e18cad42602961d0de617f8477cc2adecdd" dependencies = [ "gix-features", ] [[package]] name = "gix-glob" -version = "0.14.1" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db19298c5eeea2961e5b3bf190767a2d1f09b8802aeb5f258e42276350aff19" +checksum = "ae6232f18b262770e343dcdd461c0011c9b9ae27f0c805e115012aa2b902c1b8" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1240,9 +1240,9 @@ dependencies = [ [[package]] name = "gix-hash" -version = "0.13.3" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f8cf8c2266f63e582b7eb206799b63aa5fa68ee510ad349f637dfe2d0653de0" +checksum = "b0ed89cdc1dce26685c80271c4287077901de3c3dd90234d5fa47c22b2268653" dependencies = [ "faster-hex", "thiserror", @@ -1250,9 +1250,9 @@ dependencies = [ [[package]] name = "gix-hashtable" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb61880816d7ec4f0b20606b498147d480860ddd9133ba542628df2f548d3ca" +checksum = "ebe47d8c0887f82355e2e9e16b6cecaa4d5e5346a7a474ca78ff94de1db35a5b" dependencies = [ "gix-hash", "hashbrown 0.14.3", @@ -1261,9 +1261,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.27.1" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f308f5cd2992e96a274b0d1931e9a0e44fdcba87695ead3f6df30d8a697e9c" +checksum = "bd97a226ea6a7669109b84fa045bada556ec925e25145cb458adb4958b023ad0" dependencies = [ "bitflags 2.4.1", "bstr", @@ -1286,9 +1286,9 @@ dependencies = [ [[package]] name = "gix-lock" -version = "11.0.1" +version = "12.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5c65e6a29830a435664891ced3f3c1af010f14900226019590ee0971a22f37" +checksum = "f40a439397f1e230b54cf85d52af87e5ea44cc1e7748379785d3f6d03d802b00" dependencies = [ "gix-tempfile", "gix-utils", @@ -1297,9 +1297,9 @@ dependencies = [ [[package]] name = "gix-macros" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02a5bcaf6704d9354a3071cede7e77d366a5980c7352e102e2c2f9b645b1d3ae" +checksum = "d75e7ab728059f595f6ddc1ad8771b8d6a231971ae493d9d5948ecad366ee8bb" dependencies = [ "proc-macro2", "quote", @@ -1308,9 +1308,9 @@ dependencies = [ [[package]] name = "gix-object" -version = "0.39.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "febf79c5825720c1c63fe974c7bbe695d0cb54aabad73f45671c60ce0e501e33" +checksum = "0c89402e8faa41b49fde348665a8f38589e461036475af43b6b70615a6a313a2" dependencies = [ "bstr", "btoi", @@ -1327,9 +1327,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.55.0" +version = "0.56.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fae5f971540c99c6ecc8d4368ecc9d18a9dc8b9391025c68c4399747dc93bac" +checksum = "46ae6da873de41c6c2b73570e82c571b69df5154dcd8f46dfafc6687767c33b1" dependencies = [ "arc-swap", "gix-date", @@ -1346,9 +1346,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.45.0" +version = "0.46.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4569491c92446fddf373456ff360aff9a9effd627b40a70f2d7914dcd75a3205" +checksum = "782b4d42790a14072d5c400deda9851f5765f50fe72bca6dece0da1cd6f05a9a" dependencies = [ "clru", "gix-chunk", @@ -1367,9 +1367,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86d6fac2fabe07b67b7835f46d07571f68b11aa1aaecae94fe722ea4ef305e1" +checksum = "b8dd0998ab245f33d40ca2267e58d542fe54185ebd1dc41923346cf28d179fb6" dependencies = [ "bstr", "gix-trace", @@ -1380,9 +1380,9 @@ dependencies = [ [[package]] name = "gix-quote" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f84845efa535468bc79c5a87b9d29219f1da0313c8ecf0365a5daa7e72786f2" +checksum = "9f7dc10303d73a960d10fb82f81188b036ac3e6b11b5795b20b1a60b51d1321f" dependencies = [ "bstr", "btoi", @@ -1391,9 +1391,9 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.39.1" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2069adc212cf7f3317ef55f6444abd06c50f28479dbbac5a86acf3b05cbbfe" +checksum = "64d9bd1984638d8f3511a2fcbe84fcedb8a5b5d64df677353620572383f42649" dependencies = [ "gix-actor", "gix-date", @@ -1412,9 +1412,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.20.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d9d3b82e1ee78fc0dc1c37ea5ea76c2dbc73f407db155f0dfcea285e583bee" +checksum = "be219df5092c1735abb2a53eccdf775e945eea6986ee1b6e7a5896dccc0be704" dependencies = [ "bstr", "gix-hash", @@ -1426,9 +1426,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.24.0" +version = "0.25.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe5dd51710ce5434bc315ea30394fab483c5377276494edd79222b321a5a9544" +checksum = "aa78e1df3633bc937d4db15f8dca2abdb1300ca971c0fabcf9fa97e38cf4cd9f" dependencies = [ "bstr", "gix-date", @@ -1442,9 +1442,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d4ed2493ca94a475fdf147138e1ef8bab3b6ebb56abf3d9bda1c05372ec1dd" +checksum = "702de5fe5c2bbdde80219f3a8b9723eb927466e7ecd187cfd1b45d986408e45f" dependencies = [ "gix-commitgraph", "gix-date", @@ -1457,21 +1457,21 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a36ea2c5907d64a9b4b5d3cc9f430e6c30f0509646b5e38eb275ca57c5bf29e2" +checksum = "78f6dce0c6683e2219e8169aac4b1c29e89540a8262fef7056b31d80d969408c" dependencies = [ "bitflags 2.4.1", "gix-path", "libc", - "windows 0.48.0", + "windows 0.52.0", ] [[package]] name = "gix-tempfile" -version = "11.0.1" +version = "12.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388dd29114a86ec69b28d1e26d6d63a662300ecf61ab3f4cc578f7d7dc9e7e23" +checksum = "a8ef376d718b1f5f119b458e21b00fbf576bc9d4e26f8f383d29f5ffe3ba3eaa" dependencies = [ "gix-fs", "libc", @@ -1482,15 +1482,15 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b686a35799b53a9825575ca3f06481d0a053a409c4d97ffcf5ddd67a8760b497" +checksum = "e8e1127ede0475b58f4fe9c0aaa0d9bb0bad2af90bbd93ccd307c8632b863d89" [[package]] name = "gix-traverse" -version = "0.35.0" +version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2112088122a0206592c84fbd42020db63b2ccaed66a0293779f2e5fbf80474" +checksum = "cb64213e52e1b726cb04581690c1e98b5910f983b977d5e9f2eb09f1a7fea6d2" dependencies = [ "gix-commitgraph", "gix-date", @@ -1504,9 +1504,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.25.2" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c427a1a11ccfa53a4a2da47d9442c2241deee63a154bc15cc14b8312fbc4005" +checksum = "8f0f17cceb7552a231d1fec690bc2740c346554e3be6f5d2c41dfa809594dc44" dependencies = [ "bstr", "gix-features", @@ -1518,18 +1518,18 @@ dependencies = [ [[package]] name = "gix-utils" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f82c41937f00e15a1f6cb0b55307f0ca1f77f4407ff2bf440be35aa688c6a3e" +checksum = "de6225e2de30b6e9bca2d9f1cc4731640fcef0fb3cabddceee366e7e85d3e94f" dependencies = [ "fastrand 2.0.1", ] [[package]] name = "gix-validate" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b7d8e4274be69f284bbc7e6bb2ccf7065dbcdeba22d8c549f2451ae426883f" +checksum = "ac7cc36f496bd5d96cdca0f9289bb684480725d40db60f48194aa7723b883854" dependencies = [ "bstr", "thiserror", @@ -1597,7 +1597,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core", + "windows-core 0.51.1", ] [[package]] @@ -2382,9 +2382,9 @@ dependencies = [ [[package]] name = "prodash" -version = "26.2.2" +version = "28.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "794b5bf8e2d19b53dcdcec3e4bba628e20f5b6062503ba89281fa7037dd7bbcf" +checksum = "744a264d26b88a6a7e37cbad97953fa233b94d585236310bcbc88474b4092d79" [[package]] name = "quick-xml" @@ -3487,10 +3487,20 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core", + "windows-core 0.51.1", "windows-targets 0.48.5", ] +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core 0.52.0", + "windows-targets 0.52.0", +] + [[package]] name = "windows-core" version = "0.51.1" @@ -3500,6 +3510,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 7a3ca64aa..9ea7589df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,8 +48,8 @@ clap_complete = "4.4.5" dirs-next = "2.0.0" dunce = "1.0.4" # default feature restriction addresses https://github.com/starship/starship/issues/4251 -gix = { version = "0.56.0", default-features = false, features = ["max-performance-safe", "revision"] } -gix-features = { version = "0.36.1", optional = true } +gix = { version = "0.57.0", default-features = false, features = ["max-performance-safe", "revision"] } +gix-features = { version = "0.37.0", optional = true } indexmap = { version = "2.1.0", features = ["serde"] } log = { version = "0.4.20", features = ["std"] } # notify-rust is optional (on by default) because the crate doesn't currently build for darwin with nix diff --git a/src/context.rs b/src/context.rs index 1bd9c560c..4a651908f 100644 --- a/src/context.rs +++ b/src/context.rs @@ -319,7 +319,10 @@ impl<'a> Context<'a> { let shared_repo = match ThreadSafeRepository::discover_with_environment_overrides_opts( &self.current_dir, - Default::default(), + gix::discover::upwards::Options { + match_ceiling_dir_or_error: false, + ..Default::default() + }, git_open_opts_map, ) { Ok(repo) => repo, @@ -336,7 +339,10 @@ impl<'a> Context<'a> { ); let branch = get_current_branch(&repository); - let remote = get_remote_repository_info(&repository, branch.as_deref()); + let remote = get_remote_repository_info( + &repository, + branch.as_ref().map(|name| name.as_ref()), + ); let path = repository.path().to_path_buf(); let fs_monitor_value_is_true = repository @@ -346,7 +352,7 @@ impl<'a> Context<'a> { Ok(Repo { repo: shared_repo, - branch, + branch: branch.map(|b| b.shorten().to_string()), workdir: repository.work_dir().map(PathBuf::from), path, state: repository.state(), @@ -624,7 +630,8 @@ pub struct Repo { pub repo: ThreadSafeRepository, /// If `current_dir` is a git repository or is contained within one, - /// this is the current branch name of that repo. + /// this is the short name of the current branch name of that repo, + /// i.e. `main`. pub branch: Option, /// If `current_dir` is a git repository or is contained within one, @@ -788,24 +795,21 @@ impl<'a> ScanAncestors<'a> { } } -fn get_current_branch(repository: &Repository) -> Option { - let name = repository.head_name().ok()??; - let shorthand = name.shorten(); - - Some(shorthand.to_string()) +fn get_current_branch(repository: &Repository) -> Option { + repository.head_name().ok()? } fn get_remote_repository_info( repository: &Repository, - branch_name: Option<&str>, + branch_name: Option<&gix::refs::FullNameRef>, ) -> Option { let branch_name = branch_name?; let branch = repository - .branch_remote_ref(branch_name) + .branch_remote_ref_name(branch_name, gix::remote::Direction::Fetch) .and_then(std::result::Result::ok) .map(|r| r.shorten().to_string()); let name = repository - .branch_remote_name(branch_name) + .branch_remote_name(branch_name.shorten(), gix::remote::Direction::Fetch) .map(|n| n.as_bstr().to_string()); Some(Remote { branch, name })