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

Discarding submodule changes while selecting parent folder does not work #3951

Open
brandondong opened this issue Sep 30, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@brandondong
Copy link
Contributor

brandondong commented Sep 30, 2024

Describe the bug
At work, we have a submodule in a nested folder:
image

All this time, I thought lazygit did not support discarding submodule changes because I would open the tool, get to this screen, press d (Discard changes), hit confirm, and then nothing would happen.

Only today did I discover lazygit does actually support this. I just needed to move the selection down one item and then pressing d + confirm would work as expected.

The behavior is due to this check:

if firstNode.File != nil && firstNode.File.IsSubmodule(submodules) {

To Reproduce
Steps to reproduce the behavior:

git init
git submodule add https://github.com/jesseduffield/lazygit.git external/buildtools
git commit -m "add submodule"
git -C external/buildtools checkout HEAD~
lazygit

Press d and hit confirm.

Expected behavior
The submodule changes should be discarded. The folder only contains submodule changes so it should be no different than pressing discard on the submodule entry itself.

Also, I noticed range selecting both the folder and the submodule and then pressing discard would be disallowed due to

if submoduleCount > 0 && len(selectedNodes) > 1 {

I feel like this should also be allowed.

Screenshots
If applicable, add screenshots to help explain your problem.

Version info:

> lazygit --version
commit=611fabde11d24d9acc71ee26077b9a1101f59f27, build date=2024-09-18T10:56:10Z, build source=binaryRelease, version=0.44.1, os=windows, arch=amd64, git version=2.43.0.windows.1
> git --version
git version 2.43.0.windows.1

Additional context
Add any other context about the problem here.

Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

@brandondong brandondong added the bug Something isn't working label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant