-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Describe the bug
At work, we have a submodule in a nested folder:

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:
lazygit/pkg/gui/controllers/files_controller.go
Line 1071 in d11e11d
| 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~
lazygitPress 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
lazygit/pkg/gui/controllers/files_controller.go
Line 1058 in d11e11d
| 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.1Additional 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.