Skip to content

prCreate() now deletes a newly-created repository if it encounters an error. - #615

Closed
angus-lherrou wants to merge 2 commits into
cli:masterfrom
angus-lherrou:pr-create-bugfixes
Closed

angus-lherrou wants to merge 2 commits into
cli:masterfrom
angus-lherrou:pr-create-bugfixes

Conversation

@angus-lherrou

@angus-lherrou angus-lherrou commented Mar 8, 2020 •

Copy link
Copy Markdown

Added function ExistsRemote() in git.go to check if a branch exists at a remote.

Added a test to git_test.go to test this function on a sample repo.

Modified pr_create_test.go to account for different command executions.

Fixes #482

Added function ExistsRemote() in git.go to check if a branch exists at a remote.

Added a test to git_test.go to test this function on a sample repo.

Modified pr_create_test.go to account for different command executions.
@angus-lherrou

angus-lherrou commented Mar 8, 2020 •

Copy link
Copy Markdown
Author

This builds fine on my machine. Is there a reason git ls-remote would not be found?

Never mind, I just didn't understand what GoLand was telling me. This commit should fix it.

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

Hi thank you for the fix!

This looks like a lot of code changes and I'm reluctant to merge this due to the overall diff size. It also feels like the approach is complex: it adds new routines to delete information pushed to GitHub if any error was encountered.

As an alternative approach to this, in #618 I'm exploring how to avoid forking/pushing in the first place. That way we avoid having to potentially do cleanup (deleting repos/branches) on errors. Let me know what you think

@angus-lherrou

angus-lherrou commented Mar 9, 2020 •

Copy link
Copy Markdown
Author

Hey @mislav --

The diff does look large but much of the actual change to existing code is only to wrap a bunch of the existing code in the function in a for loop that I break out of instead of returning when there's an error. The diff looks large because all the existing lines are indented.

I think your idea of changing it to avoid forking/pushing until the end makes more sense, though.

@vilmibm vilmibm closed this in #618 Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelled pr create should not push the branch

2 participants