Commit graph

28 commits

Author SHA1 Message Date
Babak K. Shandiz
642b2c57c1
Add tests for FindByRepo
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-04 00:19:15 +01:00
Sam Coe
743a747804
Use go-gh for SSH hostname alias translation (#5654) 2022-06-08 21:32:29 +00:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Sam
9ec1e21d4c
Default to GHES host if only GHES is authenticated (#3286) 2021-03-30 16:51:00 +02:00
Mislav Marohnić
75ebb863e3 Use testify assertions for error matching 2021-01-19 13:59:37 +01:00
Cristian Dominguez
45f4a1f087 Equal: flip arguments position 2021-01-18 21:00:59 -03:00
Cristian Dominguez
3afb1d0b1a Use Testify assertions in test 2021-01-16 19:19:30 -03:00
Josh Soref
c8b9486fd3 spelling: nonexistent 2020-11-21 21:43:51 -05:00
Mislav Marohnić
d534a94d1b Change how base repository is resolved
On first run in a git repository, `BaseRepo()` will now prompt the user
which repository should be queried as base repository if there are
multiple git remotes or when we are in the context of a fork.

In non-interactive mode, the prompt is skipped and we default to the
first git remote instead.

After the base repo is resolved, the result is cached in the local
repository using `git config` so that RepositoryNetwork API lookups can
be avoided in the future.
2020-09-15 21:27:12 +02:00
Mislav Marohnić
aef1a4ba4d Extract root command and factory logic into separate packages 2020-08-07 14:40:33 +02:00
Mislav Marohnić
3ea71e6eb6 Add ability to parse non-GitHub.com git remotes 2020-06-23 19:51:26 +02:00
gedenata
8ffd0d59f6 redundant type composite literal 2020-06-12 04:23:51 +08:00
Mislav Marohnić
0a4d4ee007 Replace FakeHTTP with httpmock which is now compatible 2020-05-07 15:19:14 +02:00
vilmibm
c4693077aa move config stuff to its own package 2020-04-20 13:57:16 -05:00
Mislav Marohnić
5726376ab1 Guard against faulty affiliations GraphQL filter
This API was just fixed in github.com, but it will take a while for the
change to propagate to GitHub Enterprise installs, so guard ourselves
from false positives when querying forks.
2020-03-25 08:26:06 +01:00
Mislav Marohnić
d75faab85a Creating a PR now always prioritizes an existing fork as a push target
Before: the default push target for the current branch in `pr create`
was the first repository found among git remotes that has write access.

Now: the default push target is the fork the base repo, if said fork
exists and has write access, falling back to old behavior otherwise.

This change in the default is to facilitate contributions to projects
that have a hard requirement that all pull requests (even those opened
by people with write access to that project) come from forks.
2020-03-19 16:04:23 +01:00
vilmibm
c8a4ac66d8 start on fixing tests 2020-02-11 21:56:20 -06:00
Mislav Marohnić
8453bf679c Fix parsing non-GitHub remotes
Otherwise, the remote URL translation mechanism had crashed when
encountering a non-Github.com git remote.
2020-01-28 19:51:44 +01:00
Mislav Marohnić
a710893fc1 Rename to cli/cli 2020-01-24 16:08:52 +01:00
Mislav Marohnić
1f90579d2a Extract common interface for a GitHub Repository
Also define a handful of utility methods:
- `New(owner, repo)`
- `FullName`: the name slash owner pair
- `FromFullName`: parse the name slash owner pair
- `FromURL`: parse a GitHub.com URL
- `IsSame(r1, r2)`: compare two repositories
2020-01-22 22:44:46 +01:00
Mislav Marohnić
641de86427 Eliminate package-level state in git remote parsing 2019-10-25 21:48:25 +02:00
Mislav Marohnić
d334d56f09 Test FindByName 2019-10-17 16:10:45 +02:00
Mislav Marohnić
51c70dd918 Add test for invalid remote URLs 2019-10-17 16:05:25 +02:00
Mislav Marohnić
183db99535 Ensure remote URL parsing tests don't read user SSH config files 2019-10-17 15:58:26 +02:00
Mislav Marohnić
79e8766d8f Use eq in more tests 2019-10-17 14:44:53 +02:00
Mislav Marohnić
c09eb742c3 Keep original order of remotes 2019-10-17 13:46:35 +02:00
Mislav Marohnić
a8aa5feb02 Test remote parsing 2019-10-17 02:25:59 +02:00
Mislav Marohnić
8016d80884 Create overridable Context interface 2019-10-17 02:25:59 +02:00