-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Describe the bug
The api command forces the use of cmdutil.OverrideBaseRepoFunc(), which manually sets the owner and repo to the specified github repository.
Lines 181 to 183 in 31ffa6b
| PreRun: func(c *cobra.Command, args []string) { | |
| opts.BaseRepo = cmdutil.OverrideBaseRepoFunc(f, "") | |
| }, |
If the user is 'in' an existing repository on the cli and calls the command with {branch} as a placeholder, it fills that placeholder with the name of the checked-out-branch from the cwd.
This feels like it should not be the behaviour, as the usage text suggests that all three valid placeholders ['owner', 'repo', 'branch'] will be obtained from $GH_REPO if it is set.
Steps to reproduce the behavior
cd /path/to/some/git/repo/on/githubgit checkout -b wip/tw/pocGH_REPO=cli/cli gh api '/some/call/{owner}/{repo}/{branch}'
Expected vs actual behavior
Expected
Either:
- A request is made to the api at
/some/call/cli/cli/null - Some error is thrown as we have no good value for
{branch}under these conditions
Observed
A request is made to the api at /some/call/cli/cli/wip/tw/poc
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedContributions welcomeContributions welcomep3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic