Skip to content

Add --upstream-remote-name flag to gh replo clone - #5619

Merged
samcoe merged 3 commits into
cli:trunkfrom
ahmedadan:Issue-5467
May 24, 2022
Merged

Add --upstream-remote-name flag to gh replo clone#5619
samcoe merged 3 commits into
cli:trunkfrom
ahmedadan:Issue-5467

Conversation

@ahmedadan

@ahmedadan ahmedadan commented May 12, 2022

Copy link
Copy Markdown
Contributor

Fixes #5467

First take on the issue here, also newer to Go and the project so any guidance would be greatly appreciated.

  • Added --upstream-remote-name flag
  • Added @owner decorator

image

image

@ahmedadan
ahmedadan marked this pull request as ready for review May 12, 2022 21:21
@ahmedadan
ahmedadan requested a review from a team as a code owner May 12, 2022 21:21
@ahmedadan
ahmedadan requested review from samcoe and removed request for a team May 12, 2022 21:21
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label May 12, 2022
@samcoe samcoe self-assigned this May 16, 2022
@ahmedadan ahmedadan changed the title Add --upstream-remote-name flag to replo clone Add --upstream-remote-name flag to gh replo clone May 20, 2022

@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.

@ahmedadan Thanks for the contribution and patients while we got this reviewed. The code looks good to me. I pushed a small change that clarified some of the help documentation, added a test, and did a small refactor of AddUpstreamRemote to make it more generalized which allowed me to simplify the overall logic a bit.

@mislav What do you think of the @owner functionality introduced here?

@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.

Looks good! Thanks for adding this feature

Comment thread git/git.go

func AddUpstreamRemote(upstreamURL, cloneDir string, branches []string) error {
args := []string{"-C", cloneDir, "remote", "add"}
func AddNamedRemote(url, name, dir string, branches []string) error {

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 now has large overlap with the existing git.AddRemote() function, but it's fine for now as we can clean that up as part of #4900

@samcoe
samcoe merged commit 31bee2e into cli:trunk May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh repo clone: optionally name the upstream remote with the owner name instead of upstream

4 participants