Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompt to delete local branch when attempting to merge a PR that … #2789

Merged
merged 4 commits into from Jan 18, 2021

Conversation

dpromanko
Copy link
Contributor

@dpromanko dpromanko commented Jan 15, 2021

…is already merged

resolves #2625, resolves #2715

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

This looks good! Just a couple of polish items around interaction

}
} else {
err := prompt.SurveyAskOne(&survey.Confirm{
Message: fmt.Sprintf("Pull request #%d (%s) was already merged. Would you like to delete this local branch and switch to the default branch?", pr.Number, pr.Title),
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are not in interactive mode, this prompt should never happen. Additionally, if the user supplied --delete-branch, this prompt should never happen either — we can just continue in that case.

If you'd like, you could try additionally addressing #2715 in this PR! It will touch on the same logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback! I'll make those adjustments and look at that other issue. I might not get to it until Monday.

One other question I had for you is do you this the prompt message is too wordy/confusing? After I opened this PR I thought about it more and maybe something like ... Delete the branch locally and switch to default branch? would be more appropriate. I find my use of the word 'this' confusing when you consider merging a PR by number from another branch because in that case you aren't deleting 'this' branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dpromanko I like your proposed change with "...delete the branch locally and..." instead of the current verbiage.

Copy link
Contributor Author

@dpromanko dpromanko Jan 15, 2021

Choose a reason for hiding this comment

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

@mislav I updated this to account for non-interactive mode and the -d flag and also resolved #2715 in a separate commit df31fae.

Copy link
Contributor

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

@mislav mislav merged commit e566c61 into cli:trunk Jan 18, 2021
@dpromanko dpromanko deleted the dpromanko/2625 branch January 18, 2021 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants