fix(switch): match encoded Azure project paths - #3204
Merged
max-sixty merged 1 commit intoJun 24, 2026
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Azure DevOps remote matching for wt switch pr:N when Azure returns a decoded project name (e.g. project with spaces) but the git remote URL stores the project path segment URL-encoded (e.g. project%20with%20spaces). It does this by canonicalizing URL path segments (decode → re-encode) before comparing and when constructing Azure URLs, and adds an integration regression test.
Changes:
- Add URL path segment canonicalization helpers (
canonical_url_path_segment,url_path_segments_eq) to normalize encoded vs decoded Azure path segments. - Use canonicalized segment comparison when selecting an Azure remote (project + repo) from configured git remotes.
- Canonicalize Azure URL path segments when constructing fork/PR/build web URLs, and add an integration snapshot covering a space-containing Azure project name.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/git/url.rs |
Adds canonicalization + equality helpers for URL path segments (decode then encode) to normalize encoded/decoded forms. |
src/git/repository/remotes.rs |
Uses canonicalized segment comparison when matching Azure project/repo against configured remotes. |
src/git/remote_ref/azure.rs |
Canonicalizes organization/project/repo segments when constructing Azure remote + web URLs so URLs are consistently encoded. |
src/git/mod.rs |
Re-exports the new URL helper functions for use across git modules. |
tests/integration_tests/switch.rs |
Adds an integration test for wt switch pr:101 where the remote has an encoded project segment but the Azure API project name is decoded. |
tests/snapshots/integration__integration_tests__switch__switch_pr_azure_project_name_with_spaces.snap |
Adds the regression snapshot asserting successful switch and the expected (encoded) Azure PR web URL in output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
worktrunk-bot
approved these changes
Jun 24, 2026
jonasherfort
force-pushed
the
fix/azure-project-space-pr-switch
branch
3 times, most recently
from
June 24, 2026 08:38
ae1d834 to
ad7b6c3
Compare
jonasherfort
force-pushed
the
fix/azure-project-space-pr-switch
branch
from
June 24, 2026 08:40
32f1c53 to
8a31d9e
Compare
Owner
|
thanks @jonasherfort |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3203.
Azure DevOps returns decoded project names from
az repos pr show, while Git remotes store project path segments URL-encoded. Canonicalize Azure path segments before comparing remotes and constructing Azure URLs, sowt switch pr:Nworks for projects likeproject with spaces.Added an integration regression covering an encoded Azure project path with a decoded Azure API project name.