-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed
Labels
coreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsdocsenhancementa request to improve CLIa request to improve CLI
Description
Describe the bug
When a repo has two remotes, origin and upstream, the gh api command will use upstream for :repo instead of origin. This mean API requests are sent to the wrong repo! Also affects :owner.
gh version 1.4.0 (2020-12-15)
Steps to reproduce the behavior
mkdir test-bad-remote
cd test-bad-remote
git init
g remote add origin git@github.com:cli/cli.git
g remote add upstream git@github.com:cli/oauth.git
gh api repos/:owner/:repoExpected
{
"full_name": "cli/cli"
...
}
Actual
{
"full_name": "cli/oauth"
...
}
Perhaps wrong sort on the order here?
Lines 37 to 48 in 72eeae9
| func remoteNameSortScore(name string) int { | |
| switch strings.ToLower(name) { | |
| case "upstream": | |
| return 3 | |
| case "github": | |
| return 2 | |
| case "origin": | |
| return 1 | |
| default: | |
| return 0 | |
| } | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsdocsenhancementa request to improve CLIa request to improve CLI