Skip to content

Commit 81ec537

Browse files
unhappychoiceclaude
andcommitted
fix: disambiguate remote name comparison for gix 0.86
gix 0.86 changed `remote::Names` from a set of borrowed `BStr` to `BTreeSet<BString>`. `BString` satisfies both `AsRef<[u8]>` and `AsRef<BStr>`, so the bare `as_ref()` calls used to pick the `origin` remote no longer infer a unique type and fail to compile with E0283. Compare via `as_bstr()` and pass the `BString` straight to `find_remote`, which already accepts anything implementing `AsBStr`. Co-Authored-By: Claude Opus 5 <[email protected]>
1 parent 19572e6 commit 81ec537

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎src/fetcher/git/repo_name.rs‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
use async_trait::async_trait;
66

7+
use gix::bstr::ByteSlice;
8+
79
use crate::payload::{Body, Payload, TextData};
810
use crate::render::Shape;
911

@@ -55,9 +57,9 @@ fn remote_name(cwd: &std::path::Path) -> Option<String> {
5557
let names: Vec<_> = repo.remote_names().into_iter().collect();
5658
let preferred = names
5759
.iter()
58-
.find(|n| n.as_ref() == "origin")
60+
.find(|n| n.as_bstr() == "origin")
5961
.or_else(|| names.first())?;
60-
let remote = repo.find_remote(preferred.as_ref()).ok()?;
62+
let remote = repo.find_remote(preferred).ok()?;
6163
let url = remote.url(gix::remote::Direction::Fetch)?;
6264
slug_from_url(&url.to_bstring().to_string()).map(|s| s.name)
6365
}

‎src/fetcher/github/common.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::path::PathBuf;
55

66
use chrono::DateTime;
7+
use gix::bstr::ByteSlice;
78
use sha2::{Digest, Sha256};
89

910
use crate::fetcher::{FetchContext, FetchError};
@@ -109,10 +110,10 @@ fn remote_slug(repo: &gix::Repository) -> Option<RepoSlug> {
109110
let names: Vec<_> = repo.remote_names().into_iter().collect();
110111
let preferred = names
111112
.iter()
112-
.find(|n| n.as_ref() == "origin")
113+
.find(|n| n.as_bstr() == "origin")
113114
.or_else(|| names.first());
114115
let name = preferred?;
115-
let remote = repo.find_remote(name.as_ref()).ok()?;
116+
let remote = repo.find_remote(name).ok()?;
116117
let url = remote.url(gix::remote::Direction::Fetch)?;
117118
slug_from_url(&url.to_bstring().to_string())
118119
}

‎src/fetcher/gitlab/common.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//! trailers before the value ever reaches [`super::client::rest_get`].
1212
1313
use chrono::DateTime;
14+
use gix::bstr::ByteSlice;
1415
use sha2::{Digest, Sha256};
1516

1617
use crate::fetcher::{FetchContext, FetchError};
@@ -145,9 +146,9 @@ fn remote_project_from_cwd(host: &str) -> Option<ProjectPath> {
145146
let names: Vec<_> = repo.remote_names().into_iter().collect();
146147
let preferred = names
147148
.iter()
148-
.find(|n| n.as_ref() == "origin")
149+
.find(|n| n.as_bstr() == "origin")
149150
.or_else(|| names.first())?;
150-
let remote = repo.find_remote(preferred.as_ref()).ok()?;
151+
let remote = repo.find_remote(preferred).ok()?;
151152
let url = remote.url(gix::remote::Direction::Fetch)?;
152153
project_from_url(&url.to_bstring().to_string(), host)
153154
}

0 commit comments

Comments
 (0)