Repository navigation
feat: use prefixed branch name for conflicting fork PR branches - #779
Merged
Merged
Conversation
When a fork PR's branch name conflicts with an existing local branch (e.g., contributor opens PR from their `main` branch), create a prefixed branch name like `contributor/main` instead of failing. This allows users to checkout and review fork PRs even when the branch name is taken locally. Push to fork is not supported with prefixed branches since git push requires matching local/remote names. Closes #714 Co-Authored-By: Claude <[email protected]>
Add integration tests for: - Prefixed branch already exists and tracks same PR (reuse) - Prefixed branch exists but tracks different PR (error) Co-Authored-By: Claude <[email protected]>
The test was creating a worktree at `test-repo.contributor-feature-fix` but the test repo's directory is named `repo`, not `test-repo`. This caused the snapshot path normalization to fail on CI. Changed the path to `repo.contributor-feature-fix` to match the test repo's naming convention, ensuring consistent path normalization. Co-Authored-By: Claude <[email protected]>
Changed the error detection in `fetch_pr_info()` from string matching
to using `std::io::ErrorKind::NotFound`, which is the cross-platform
approach already used in `fetch_mr_info()`.
String matching ("No such file", "not found", "cannot find") was
failing on Windows where the error message format differs.
Co-Authored-By: Claude <[email protected]>
On Windows, creating symlinks requires Developer Mode or admin privileges. The tests that simulate "gh/glab not installed" by creating a minimal PATH with only git now gracefully skip if symlink creation fails. Also simplified the error detection in pr_ref.rs to use ErrorKind instead of string matching, matching the approach in mr_ref.rs. Co-Authored-By: Claude <[email protected]>
On Windows, git requires its entire installation directory to function correctly - just symlinking git.exe isn't enough. We can't easily create a minimal PATH with just git while excluding gh/glab without breaking git itself. Skip these tests on Windows using cfg(windows). The tests verify that the error message is correct when gh/glab isn't installed, but this specific behavior is adequately tested on Linux/macOS. Co-Authored-By: Claude <[email protected]>
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.
Summary
contributor/main) instead of failingCloses #714
Test plan
prefixed_local_branch_name()🤖 Generated with Claude Code