seachicken/gh-poi

PRs in forked repository is not associated when local has multiple remotes

Closed this issue · 3 comments

Describe the bug
If the remotes looks like this:
git remote -v

origin  git@github.com:seachicken/a.git (fetch)
origin  git@github.com:seachicken/a.git (push)
upstream        git@github.com:upstream/a.git (fetch)
upstream        git@github.com:upstream/a.git (push)

PRs in origin are not shown in the results of gh poi.

Your Environment

  • OS: macOS Monterey
  • gh --version: 2.5.0

Currently I use gh repo view to determine which repository to search for PRs, but if there are multiple remotes, the first element seems to be selected.
https://github.com/cli/cli/blob/c9f44ffda9f9ff77820e5dda9b7b8885ad2136d7/context/context.go#L82
This will select the upstream, but expects the origin to be selected.

As a workaround, we can work around this problem by selecting the base repository with the gh command.

  1. Run gh repo view in the direcotory of local repository
  2. Select the forked repository (e.g. seachicken/a)

However, this method of manipulating the base repository is subject to change in the future (related issue)

Here is my braindump for now:

  1. Target repositories whose remote name is origin, otherwise use the first element

  2. Target all remote repositories