Skip to content

Commit

Permalink
fix: transform master to ref:master in ls-remote for zig (#2409)
Browse files Browse the repository at this point in the history
Currently ls-remote zig shows `master` as a valid version but this isn't
actually accepted by mise and throws a somewhat cryptic error. The
correct version to specify if you want nightly is ref:master so this
adds a simple transformation to direct the user to the correct value.

Fixes #2403

Co-authored-by: jdx <[email protected]>
  • Loading branch information
chasinglogic and jdx authored Jul 29, 2024
1 parent 1865fb5 commit 7de3dcc
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/plugins/core/zig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,18 @@ impl ZigPlugin {

fn fetch_remote_versions(&self) -> Result<Vec<String>> {
match self.core.fetch_remote_versions_from_mise() {
Ok(Some(versions)) => return Ok(versions),
Ok(Some(versions)) => {
return Ok(versions
.into_iter()
.map(|r| {
if r == "master" {
"ref:master".to_string()
} else {
r
}
})
.collect())
}
Ok(None) => {}
Err(e) => warn!("failed to fetch remote versions: {}", e),
}
Expand All @@ -52,6 +63,13 @@ impl ZigPlugin {
let versions = releases
.into_iter()
.map(|r| r.tag_name)
.map(|r| {
if r == "master" {
"ref:master".to_string()
} else {
r
}
})
.unique()
.sorted_by_cached_key(|s| (Versioning::new(s), s.to_string()))
.collect();
Expand Down

0 comments on commit 7de3dcc

Please sign in to comment.