{{ message }}
Repository navigation
Conversation
`pr create --fill` assumed that the selected PR repository remote also contained the local tracking ref for `--base`. When that ref existed only on another remote, the generated Git log range referenced a nonexistent ref and failed before the PR could be created. Owner-qualified bases had two related problems. The owner leaked into the Git revision, producing refs such as `upstream/MyOrg:branch`, and the owner was discarded when constructing the PR target. As a result, `--web` still opened the compare page for the default repository instead of the repository selected by `OWNER:branch`. Build an ordered list of base tracking refs, starting with the default PR remote and falling back to other matching remotes when the Git log fails. For `OWNER:branch`, resolve the remote by owner and host, use its repository as the PR base for both API and web flows, and use the unqualified branch name for the Git comparison and GitHub request. This also supports forks whose repository name differs from the upstream repository. Preserve the original Git error when no candidate succeeds. Add regression coverage for unqualified remote fallback and an exact owner-qualified `--web --fill` flow.
9999years
marked this pull request as draft
August 19, 2026 00:42
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
Improves pr create base resolution for --fill and owner-qualified bases.
Changes:
- Retries Git log using matching remotes.
- Resolves
OWNER:branchto its target repository. - Adds regression tests for fallback and web flows.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
pkg/cmd/pr/create/create.go |
Implements base repository and tracking-ref resolution. |
pkg/cmd/pr/create/create_test.go |
Tests remote fallback and qualified web creation. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return nil, "", nil, err | ||
| } | ||
| } | ||
| return resolvedBaseRepo, branch, trackingBranches, nil |
| } | ||
| resolvedBaseRepo := baseRepo | ||
| if !ghrepo.IsSame(baseRemote, baseRepo) { | ||
| resolvedBaseRepo, err = api.GitHubRepo(client, baseRemote) |
| } | ||
| } | ||
|
|
||
| resolveBase := func(base string) (*api.Repository, string, []string, error) { |
Comment on lines
+781
to
+787
This branch has not been deployed
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.

NB: This is AI generated and although I've tested it manually, I haven't read the code; it's not ready for review or submission yet.
pr create --fillassumed that the selected PR repository remote also contained the local tracking ref for--base. When that ref existed only on another remote, the generated Git log range referenced a nonexistent ref and failed before the PR could be created.Owner-qualified bases had two related problems. The owner leaked into the Git revision, producing refs such as
upstream/MyOrg:branch, and the owner was discarded when constructing the PR target. As a result,--webstill opened the compare page for the default repository instead of the repository selected byOWNER:branch.Build an ordered list of base tracking refs, starting with the default PR remote and falling back to other matching remotes when the Git log fails. For
OWNER:branch, resolve the remote by owner and host, use its repository as the PR base for both API and web flows, and use the unqualified branch name for the Git comparison and GitHub request. This also supports forks whose repository name differs from the upstream repository. Preserve the original Git error when no candidate succeeds.Add regression coverage for unqualified remote fallback and an exact owner-qualified
--web --fillflow.