Commit graph

44 commits

Author SHA1 Message Date
Zack Sloane
f70bcba779 switch to [] characters for default info in usage strings 2024-02-01 21:35:31 +00:00
Zack Sloane
b6dadfa7fb test update, more consistent default value display 2024-01-08 23:23:24 -05:00
Sam Coe
7924878315
Fix git protocol and refactor Config interface (#8246) 2023-10-27 15:42:05 +02:00
William Martin
6dc04bb1e2 Remove GetOrDefault uses in favour of GitProtocol 2023-10-19 12:57:19 +02:00
Sam Coe
98ab1f2587
Authenticate network git commands (#6541) 2022-11-15 13:14:37 +02:00
Sam Coe
f96b2fce57
Refactor git client and add tests (#6525) 2022-11-03 11:58:38 +01:00
Sam Coe
4294ee14a1
revert revert 57fbe4f317 (#6474) 2022-10-20 12:17:20 +00:00
Sam Coe
2cefb9fa59
Fix pr create regression (#6472)
* Revert "Refactor to use new git client (#6447)"

This reverts commit 57fbe4f317.

* Fix pr create regression
2022-10-20 12:46:23 +03:00
Sam Coe
57fbe4f317
Refactor to use new git client (#6447) 2022-10-19 21:11:36 +03:00
Sam Coe
2944f7c3ab
Create git client (#6354) 2022-10-14 07:47:03 +00:00
HÃ¥vard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
nate smith
562f1b3d0d add GetOrDefault functionality to config 2022-01-11 14:56:58 -06:00
Rasmus Wriedt Larsen
9e3893e104 Also set pushRemote on gh pr checkout from fork
As explained in https://git-scm.com/docs/git-config#Documentation/git-config.txt-branchltnamegtremote
if you have `remote.pushDefault` set in your global gitconfig (like I
do), then _that_ setting will take precedence over
`branch.<name>.remote` 😞

However, `branch.<name>.pushRemote` will take precedence over your
`remote.pushDefault` setting, such that
`gh pr checkout 123 && make changes && git push` will just work, even if
you have `remote.pushDefault` set 💪
2021-09-24 16:38:25 +00:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
9a485ddfa2 💅 Cleanup local branch handling during pr checkout 2021-08-05 20:44:34 +02:00
Des Preston
294a029e70 add --branch flag to pr checkout
Allows renaming the checked out branch.
2021-08-05 20:44:20 +02:00
Mislav Marohnić
053d43f705 Fix pr checkout setting up git push configuration 2021-05-25 15:43:18 +02:00
Mislav Marohnić
b9a4a425bf Fix pr checkout for PRs coming from deleted forks 2021-05-24 16:52:53 +02:00
Mislav Marohnić
79896ed513 Fix pr checkout for cross-repository pull requests 2021-05-19 13:18:04 +02:00
Mislav Marohnić
42155c7d2d Export more IDs in issue/pr JSON payload 2021-05-18 18:19:28 +02:00
Mislav Marohnić
c50d390cf5 Fix tests 2021-05-07 22:09:58 +02:00
Mislav Marohnić
9bdc63c4ca Eliminate API overfetching in pr commands
This completely rewrites the PR lookup mechanism so that the caller
must specify the GraphQL fields to query for each PR. Additionally, this
fixes some export problems with `pr view --json`.

Features:

- Each pr command now gets assigned a concept of a Finder. This makes it
  easier to stub the PR in tests without having to stub the underlying
  HTTP calls or git invocations.

- `pr view --web` is much faster since it only fetches the "url" field.

- `pr diff 123` now skips a whole API call where a whole PR was
  unnecessarily preloaded just to access its diff in a subsequent call.

- PullRequestGraphQL query builder is now used to construct queries.

- A bunch of individual commands are now freed of having to know about
  concepts such as BaseRepo, Branch, Config, or Remotes.
2021-04-30 20:34:36 +02:00
Gowtham Munukutla
56ead91702 Add helper function to validate exact args in cmdutil 2021-02-24 15:49:40 +05:30
Mislav Marohnić
88c27934a1 Update some stubs to be closer to how git behaves 2021-01-28 21:58:45 +01:00
Devon Romanko
2964895a77 fix test behavior changes from migration to run.Stub 2021-01-27 18:46:29 -05:00
Devon Romanko
cb897fd7e2 remove unused errorStub from 'pr checkout' test 2021-01-27 08:04:57 -05:00
Devon Romanko
a04e0ece71 use Stub instead of SetPrepareCmd in 'pr checkout' tests 2021-01-27 07:53:21 -05:00
Sam Coe
cec3aa294e
Support detach head for pr checkout 2021-01-25 11:22:33 -08:00
Mislav Marohnić
874375f01e 💅 pr checkout --force 2021-01-22 22:37:20 +01:00
Neel Redkar
a89fa1ebed add ability to force checkout 2021-01-22 22:29:01 +01:00
Mislav Marohnić
06cf2c9f81 Merge remote-tracking branch 'origin' into cmd-stub-new 2021-01-22 16:31:29 +01: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
Mislav Marohnić
c308f1cd91 Prevent further use of SetPrepareCmd and InitCmdStubber 2021-01-18 22:44:53 +01:00
Cristian Dominguez
3afb1d0b1a Use Testify assertions in test 2021-01-16 19:19:30 -03:00
Mislav Marohnić
5b4a08dcb9 Ensure that only PATH is searched when shelling out to external commands
Works around https://github.com/golang/go/issues/38736 for Windows.
2020-11-11 16:33:13 +01:00
Alisson Santos
cf617e88f4 Extract repeated code to util function 2020-11-03 22:05:04 +01:00
Martín Montes
bb1005be51 Fixed gh pr checkout on detached HEAD 2020-09-22 00:25:49 +02:00
Mislav Marohnić
f9239661f2 Reuse the StubRepoInfoReponse test helper 2020-09-16 15:01:13 +02:00
vilmibm
16f69e9c12 fix tests 2020-08-19 16:40:13 -05:00
vilmibm
5c4f93ad0a Merge remote-tracking branch 'origin/trunk' into pr-checkout-submodules 2020-08-19 16:37:01 -05:00
Mislav Marohnić
6490d7717c Fix --repo override taking effect for pr commands 2020-08-06 21:39:46 +02:00
Mislav Marohnić
8cba134f5d Fix pr checkout test 2020-08-04 15:10:44 +02:00
Mislav Marohnić
487dd06bf3 Isolate pr checkout command 2020-07-29 22:50:34 +02:00