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 Squash merge #3566

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

Conversation

noahfraiture
Copy link

@noahfraiture noahfraiture commented May 16, 2024

  • PR Description

Hello,

This PR add merge --squash. A PR already exist #3130, but the author abandoned it, so I remake it.
I modified to fit most of the comment made except this one https://github.com/jesseduffield/lazygit/pull/3130/files#r1404808121. I didn't find an existing example and thus didn't know to modify the code to fit it to the new way of doing things.

There's still the choice box to commit or not to do as discussed #3130 (comment). I'll do it when I have time, I first need to read the code to see how it really works.

Also only english has been made for now.

image

  • 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

fix typo

fix checkout branch
add langage and menu pannel
fix: type and rename files

add refresh

remove current branch in squashFiles tooltip
@noahfraiture noahfraiture marked this pull request as ready for review May 19, 2024 22:40
@noahfraiture
Copy link
Author

Hello, I finished the feature, and it seems to work well, I will add tests in futures days, but I would like your feedback already if you feel it's needed. The only problem is to generate the cheatsheet, they seem to be empty for the squash, but I don't find where the generate takes them from. It's my first PR, hope it's good

Copy link
Contributor

@AzraelSec AzraelSec left a comment

Choose a reason for hiding this comment

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

Hello 👋🏻 I left a couple of comments on your PR to discuss while you write the tests.

Comment on lines 360 to 362
if checkedOutBranchName == refName {
return func() error { return errors.New(self.c.Tr.CantMergeBranchIntoItself) }
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What Stefan suggested in the original PR was to use the DisableReason field exposed by the MenuItem type to inhibit the actions instead of throwing an error when they're invoked.

Do to this, you should move this check to the upper level (the SquashBranch function) and conditionally set the DisabledReason field in case checkedOutBranchName == refName. Also, consider that both those menu options are disabled for the same reason.

pkg/gui/controllers/branches_controller.go Show resolved Hide resolved
@noahfraiture
Copy link
Author

I have your suggestion which seems indeed better suited but there's a bug and I can't figure out if it's mine or not. The feature is always disabled even if the ShowErrorInPanel is set to false.
image
I wrote the bool value for debugging purpose and you can see that it is false and the feature should be enabled.

Do you have any idea why ?

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.

None yet

2 participants