Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to select default branch (main) on upstream repo, when working off a fork #5470

Closed
RasmusWL opened this issue Nov 15, 2023 · 6 comments · Fixed by #5595
Closed

Unable to select default branch (main) on upstream repo, when working off a fork #5470

RasmusWL opened this issue Nov 15, 2023 · 6 comments · Fixed by #5595
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded

Comments

@RasmusWL
Copy link

Steps to Reproduce:

  1. Work on a fork of a repo.

  2. Create a branch on top of a non-main branch on your own fork

    $ git log --oneline --graph
    * d93926291d - (HEAD -> example-pr) dummy (33 seconds ago) <Rasmus Wriedt Larsen>
    * 69453aa144 - (origin/clean-tests, clean-tests) Python: Fix missing newline in `.expected` (26 minutes ago) <Rasmus Wriedt Larsen>
    * 55f5b26ba6 - Python: Accept new ordering of query predicates in `.expected` (27 minutes ago) <Rasmus Wriedt Larsen>
    * 721bde1ce8 - Python: Delete orphaned `.expected` files (37 minutes ago) <Rasmus Wriedt Larsen>
    *   2e9d548083 - (upstream/main, upstream/HEAD, origin/main, main) Merge pull request #14706 from RasmusWL/class-attribute-flow (2 hours ago) <Rasmus Wriedt Larsen
    
  3. Use extension to start creating a PR.

    • it initially suggested to use the non-main branch as the target for this PR. Image
  4. Use the Change Repository... feature of the branch selector of the base branch, set it to upstream (github/codeql)

  5. Search for main on upstream

    • but get no results 😞
      Image

(I am able to select main on the origin remote, but that just files a PR against the main branch on my own fork 🙈)

@alexr00
Copy link
Member

alexr00 commented Nov 20, 2023

@RasmusWL the initial suggestion is expected: If you are on a fork, and you create a branch from a branch that isn't the default branch (exactly as you did), then the suggested base branch will be the branch that you branched off of.

Branches from the upstream repo should be listed in the "Base" picker" as you expected. However, it looks like we aren't detecting your upstream repo at all. Can you share the output of git remote -v?

@alexr00 alexr00 self-assigned this Nov 20, 2023
@alexr00 alexr00 added the info-needed Issue requires more information from poster label Nov 20, 2023
@RasmusWL
Copy link
Author

RasmusWL commented Nov 20, 2023

Sure thing 👍

$ git remote -v
amammad	git@github.com:amammad/codeql (fetch)
amammad	git@github.com:amammad/codeql (push)
origin	git@github.com:RasmusWL/codeql.git (fetch)
origin	git@github.com:RasmusWL/codeql.git (push)
upstream	git@github.com:github/codeql.git (fetch)
upstream	git@github.com:github/codeql.git (push)

(amammad remote probably got added after doing gh pr checkout ... on a PR that originated on that fork)

@alexr00
Copy link
Member

alexr00 commented Dec 20, 2023

Thanks, can you also share the value of githubPullRequests.remotes?

@RasmusWL
Copy link
Author

RasmusWL commented Jan 4, 2024

Hope it's just the value from Settings 🤞

Image

"githubPullRequests.remotes": [
  "origin",
  "upstream"
]

@alexr00
Copy link
Member

alexr00 commented Jan 8, 2024

I can repro. We don't fetch all branches if it takes more than 5 seconds to fetch them all. Even when this happens, we should still include main.

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels Jan 8, 2024
@alexr00 alexr00 added this to the December / January 2024 milestone Jan 8, 2024
alexr00 added a commit that referenced this issue Jan 8, 2024
alexr00 added a commit that referenced this issue Jan 9, 2024
* Unable to select default branch (`main`) on upstream repo, when working off a fork
Fixes #5470

* Remove duplicate check

* Add metadata check back in
@TylerLeonhardt
Copy link
Member

image Looks good!

@TylerLeonhardt TylerLeonhardt added the verified Verification succeeded label Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants