Skip to content

gh repo rename - #4450

Merged
samcoe merged 50 commits into
trunkfrom
repo-rename
Nov 4, 2021
Merged

samcoe merged 50 commits into
trunkfrom
repo-rename

Conversation

@pxrth9

@pxrth9 pxrth9 commented Oct 6, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #1399

@pxrth9 pxrth9 self-assigned this Oct 6, 2021
@pxrth9 pxrth9 linked an issue Oct 8, 2021 that may be closed by this pull request
@pxrth9 pxrth9 added core This issue is not accepting PRs from outside contributors enhancement a request to improve CLI labels Oct 12, 2021
@pxrth9
pxrth9 requested review from mislav and vilmibm October 12, 2021 22:46
@pxrth9
pxrth9 marked this pull request as ready for review October 12, 2021 22:48
@pxrth9
pxrth9 requested a review from a team as a code owner October 13, 2021 19:04

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! One question about local git remotes that still point to the old name. If gh repo rename is run from the context of the local checkout of the repository that's just been renamed, should we update the git remote to point to the new name? I'm guessing that if we don't, users might perceive that as a bug (or, at least, as a missed opportunity) of repo rename.

Team: what do you think?

Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
@pxrth9
pxrth9 requested review from mislav and samcoe October 22, 2021 18:44
@pxrth9

pxrth9 commented Oct 22, 2021

Copy link
Copy Markdown
Contributor Author

Just one minor thing is that when the tests are run it changes the "origin" remote, I'm guessing it because of the way it's defined. I don't think that is ideal, any ideas on how to fix it? @mislav @samcoe

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pxrth9 I left a couple more comments, mostly small UX polish. Regarding the tests, that is happening because the git remote set call needs to be stubbed out in the tests that call it. You can use the internal/run/stub.go package to do it. There are numerous examples in our tests that you probably can copy from.

Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
@pxrth9
pxrth9 requested a review from samcoe October 26, 2021 22:10
Comment thread pkg/cmd/repo/rename/http_test.go Resolved
Comment thread pkg/cmd/repo/rename/http.go Resolved
Comment thread pkg/cmd/repo/rename/http_test.go Resolved
Comment thread pkg/cmd/repo/rename/http_test.go Resolved
Comment thread pkg/cmd/repo/rename/http_test.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename_test.go Resolved
@pxrth9
pxrth9 requested a review from samcoe October 27, 2021 16:20

@samcoe samcoe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thanks for being patient through the review process!

@samcoe
samcoe enabled auto-merge October 27, 2021 18:14

@vilmibm vilmibm left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work!!

In testing this I did an accidental rename that scared me half to death so I took the liberty of adding a confirmation step for the specific invocation gh repo rename newname. There's no confirmation if -R is used or if the repo was prompted for.

It's a testament to how nice your code and tests were that I could add the change so quickly, well done.

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking excellent. I got some polish-level requests, as well as pointing out some formatting and spelling mistakes.

Comment thread pkg/cmd/repo/rename/http.go Resolved
Comment thread pkg/cmd/repo/rename/http.go Resolved
Comment thread pkg/cmd/repo/rename/http.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
Comment thread pkg/cmd/repo/rename/rename.go Resolved
@pxrth9
pxrth9 requested a review from mislav November 3, 2021 16:20

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent. Thanks for the hard work!

@samcoe
samcoe merged commit 67d1a90 into trunk Nov 4, 2021
@samcoe
samcoe deleted the repo-rename branch November 4, 2021 17:52
@mislav

mislav commented Nov 4, 2021

Copy link
Copy Markdown
Contributor

Whoops, I meant to squash-merge this but it appears it already had auto-merge enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core This issue is not accepting PRs from outside contributors enhancement a request to improve CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rename repository command

4 participants