Commit graph

37 commits

Author SHA1 Message Date
Yukai Chou
2374e82633 Fix doc typo for repo sync 2024-08-23 00:17:31 +08:00
Yukai Chou
c81ccab4b8
Quote repo names consistently in gh repo sync stdout (#9491)
* Quote repo names consistently in `gh repo sync` stdout

* Update tests
2024-08-21 12:20:45 -07:00
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
Yukai Chou
061ec2f51b s/default branch/main branch/g 2023-11-23 07:21:16 +08:00
EBIBO
14a8e03bc3
gh repo sync should be able to sync a local branch with an upstream remote (#8229) 2023-11-20 10:37:59 +00:00
Sam Coe
ddfe476ff9
Remove old code paths and improve code comments for repo sync (#7610) 2023-06-23 11:32:48 +00:00
Marco Carvalho
3b23978114
repo sync: clearer error message with actionable hint (#7110)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2023-03-28 18:43:31 +00: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
c89d0402bb
Improved error messaging for repo sync scenario (#6430) 2022-10-14 09:46:12 +00:00
Kevin Lee
0d143ca89c
Consistent punctuation in command usages (#5139)
* Fix spelling and grammatical errors in command docs
* Add periods for consistency across the long command descriptions
* Format imports
2022-01-31 10:56:12 +00:00
Mislav Marohnić
1260023547 repo sync: Use the new merge-upstream API if available
This helps avoid the errors when a new commit from upstream is not yet
available in the fork, resulting in a HTTP 404 when trying to update the
ref in the fork.

If the merge-upstream API is unavailable (404) or errors out (409/422),
the functionality falls back to the previous functionality of manually
updating refs. This ensures that `--force` still has effect.
2021-12-21 16:44:27 +01:00
Sam Coe
0305788536
Typo 2021-09-16 09:02:10 -07:00
Sam Coe
a8492bb0ea
Allow user input for git fetch in repo sync 2021-09-13 10:14:20 -07:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
6136a39ed6 Use remotes.FindByRepo() 2021-08-10 14:30:36 +02:00
Mislav Marohnić
0f1ab13b9e Only check if working copy is dirty when syncing current branch
In other cases, we don't have to abort the operation since it can
proceed without being affected by the working copy at all.
2021-08-10 14:29:23 +02:00
Mislav Marohnić
66ad6ad7d0 Avoid git checkout during gh repo sync
- If the local branch already exists, use `git update-ref`
- If it needs to be created, use `git branch <newbranch>`, but don't
  switch to the new branch

Bonus fixes
- Enables operation while on detached HEAD
- Enables operation even when the current remote doesn't track all
  branches in the remote repo (uses FETCH_HEAD instead of the
  `<remote>/<branch>` syntax)
2021-08-09 22:10:52 +02:00
Sam Coe
174e26ecac
Fix tests 2021-08-04 18:26:30 -07:00
Sam Coe
2c4a662660
Rework git client interface 2021-08-04 18:13:58 -07:00
Sam Coe
00d67e3e5a
Remove unnecessary + 2021-08-04 17:10:50 -07:00
Sam Coe
86f16dbaf5
Use more idiomatic pattern 2021-08-04 17:00:20 -07:00
Sam Coe
c0756c2d1c
Clean up UX 2021-08-04 16:42:27 -07:00
Sam Coe
63f7372b31
Fix lint 2021-07-01 09:55:13 -07:00
Sam Coe
a1e1842e6d
Catch a couple more edge cases 2021-06-29 20:48:30 -07:00
Sam Coe
0b80c30789
Fix remote resolving for source repo 2021-06-28 17:00:06 -07:00
Sam Coe
5481b2b5e6
Move dirty repo check before any network calls 2021-06-24 09:08:36 -07:00
Sam Coe
8219710551
Address PR comments 2021-06-23 14:20:14 -07:00
Sam Coe
0e838052a4
Rewrite tests with new mocks 2021-06-23 12:01:58 -07:00
Sam Coe
4ed2bfc4a0
Revert "Add counterfeiter"
This reverts commit 096f30a319.
2021-06-22 13:55:30 -07:00
Sam Coe
096f30a319
Add counterfeiter 2021-06-14 10:51:51 -04:00
Sam Coe
2729af50df
Cleanup SyncOptions 2021-06-14 10:51:51 -04:00
Sam Coe
8d61b96bde
Fix up error message 2021-06-14 10:51:51 -04:00
Sam Coe
8b5abc77ea
Extract git interactions into interface 2021-06-14 10:51:51 -04:00
Sam Coe
86e16cc7c4
Add repo sync command 2021-06-14 10:51:50 -04:00