Skip to content

After cloning a fork, pr status will query the wrong base repo #251

@mislav

Description

@mislav

Now that a better pr create #238 has landed and supports submitting PRs from one's fork, we should address some edge-cases that arise in the light of new features.

After cloning your own fork, doing some work, and running gh pr create within that repo, the improved base repo resolution mechanism will kick in and submit the PR to the parent repo of the fork, since it's little likely that the person wants to open a PR in their own fork.

However, when running gh pr status or pr list, their fork will be queried instead of the parent repo and there will usually be no results.

This is because the base repo resolution is now different in pr create and other commands: other commands don't look up repository information from API; they simply assume that the upstream or origin git remote points to the base repo.

We should consider expanding the base lookup logic from pr create to all other commands for consistency, but that might incur a small delay before running every command. There might be other approaches to compensate for speed:

  • automatically add an upstream remote to point to base if origin is detected to be a fork;
  • look up the base repository via API on every command, but cache the result per-repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions