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

Added Merge keybind in tag submenu, closes #1315 #3383

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

RetoranPetra
Copy link

  • PR Description
    Noticed @adamDilger had made a commit to fix Merging a tag into the checked-out branch #1315 on his own repository, but never made a pull request. Made some changes to be up to be up to date with master, and made this pull request.
    First proper pull request so please let me know if there's any issues and I'll do my best to resolve them.

  • Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • Docs (specifically docs/Config.md) have been updated if necessary
  • You've read through your own file changes for silly mistakes etc

closes jesseduffield#1315

credit to @adamDilger for original commit, I slightly modified it to
match master then did the pull request.
@adamDilger
Copy link

🙏 thanks for following this up! I never got around to the final polish+PR step, and have since forgotten about it a few times 😆

Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

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

Looking good, left some comments

Key: opts.GetKey(opts.Config.Branches.MergeIntoCurrentBranch),
Handler: opts.Guards.OutsideFilterMode(self.withItem(self.merge)),
Description: self.c.Tr.Merge,
Tooltip: self.c.Tr.MergeBranchTooltip,
Copy link
Owner

Choose a reason for hiding this comment

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

We should add a new tooltip called MergeTagTooltip because the current tooltip only mentions branches

Copy link
Author

Choose a reason for hiding this comment

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

Got it, I'll work on this when I get some free time along with the other comment.

Copy link
Author

Choose a reason for hiding this comment

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

Added this in 91a620c, let me know if I should squash these down.

@@ -236,6 +243,10 @@ func (self *TagsController) create() error {
})
}

func (self *TagsController) merge(tag *models.Tag) error {
return self.c.Helpers().MergeAndRebase.MergeRefIntoCheckedOutBranch(tag.RefName())
Copy link
Owner

Choose a reason for hiding this comment

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

We should focus the local branches view after merging so that the user has more context on what's going on. Let me know if you need help with that

Copy link
Author

Choose a reason for hiding this comment

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

Added this in f6a2423, let me know if it's preferred to squash down these commits.

Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

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

Code looks good. Could you add an integration test for this?

Also re: squashing commits: yep before we merge the commits should be squashed down to one

@RetoranPetra
Copy link
Author

Good thing you asked for integration tests, found out that the way I changed the view caused the tag merge to stop working, and hadn't verified it before this.

It seems to be that MergeRefIntoCheckedOutBranch() gives a return value before the user hits enter on the popup confirmation window, so when I change the view to local branches it gets rid of the pop up and the merge never occurs.

That'd be my first guess, I can do some digging around with a debugger to figure out what exactly is happening but I'm not too familiar with go or its tools so it may take a while.

@stefanhaller
Copy link
Collaborator

Your guess is exactly right. One way to solve this is to pass a callback to MergeRefIntoCheckedOutBranch that is called at the end of the OnConfirm. Let me know if you need more help.

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.

Merging a tag into the checked-out branch
4 participants