Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dev-tools/backends/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Specifies a custom version prefix for release tags. By default, mise handles the

When `version_prefix` is configured, mise will:

- Strip the prefix when listing available versions
- Filter available versions with the prefix and strip it
- Add the prefix when searching for releases
- Try both prefixed and non-prefixed versions during installation

Expand Down
2 changes: 1 addition & 1 deletion docs/dev-tools/backends/gitlab.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Specifies a custom version prefix for release tags. By default, mise handles the

When `version_prefix` is configured, mise will:

- Strip the prefix when listing available versions
- Filter available versions with the prefix and strip it
- Add the prefix when searching for releases
- Try both prefixed and non-prefixed versions during installation

Expand Down
8 changes: 8 additions & 0 deletions src/backend/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,21 @@ impl Backend for UnifiedGitBackend {
let releases = gitlab::list_releases_from_url(api_url.as_str(), &repo).await?;
Ok(releases
.into_iter()
.filter(|r| {
opts.get("version_prefix")
.is_none_or(|p| r.tag_name.starts_with(p))
})
Comment on lines +48 to +51
Copy link

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering logic is duplicated between GitLab and GitHub branches. Consider extracting this into a helper method to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
.map(|r| self.strip_version_prefix(&r.tag_name))
.rev()
.collect())
} else {
let releases = github::list_releases_from_url(api_url.as_str(), &repo).await?;
Ok(releases
.into_iter()
.filter(|r| {
opts.get("version_prefix")
.is_none_or(|p| r.tag_name.starts_with(p))
})
.map(|r| self.strip_version_prefix(&r.tag_name))
.rev()
.collect())
Expand Down
Loading