Repository navigation
fix(switch): accept Gitea PR source branches named pull/... - #4832
Merged
Merged
Conversation
is_real_branch_name rejected any candidate starting with pull/ or pulls/ to filter Gitea's pulls/<n>/head tracking refs, so wt switch pr:N on a same-repo PR from a branch like pull/fix-login bailed with "no usable source branch". Match only the <n>/head tracking-ref shape.
1 task
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.
On a Gitea PR whose source branch name starts with
pull/orpulls/, such aspull/fix-login,wt switch pr:Nfailed with "has no usable source branch … may be in an invalid state". The branch is valid; the fix lets wt check it out.The cause is
is_real_branch_nameinsrc/git/remote_ref/gitea.rs. It rejected every candidate with either prefix so it could filter out thepulls/<n>/headtracking ref Gitea reports for a deleted source branch, and that also caught real branches. It now rejects only the tracking-ref shape:pull/orpulls/, then a number, then/head. Fully qualifiedrefs/...values and placeholders with whitespace are still rejected as before. The failing path isremote_ref::fetch_pr_info→gitea::fetch_pr_info→extract_source_branch_from_parts.The new unit test
test_extract_source_branch_accepts_branch_named_pullfailed before the change and passes after it. The existing tests for placeholders and deleted branches still pass. Found by the nightly survey.