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

Unable to unstage submodule changes when there are uncommitted changes within the submodule #3641

Open
RetoranPetra opened this issue Jun 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@RetoranPetra
Copy link

Describe the bug
As described above, when attempting to unstage a submodule's changes with spacebar after staging said changes, instead of unstaging the currently staged changes within the submodule it quickly moves the changes from "staged" to "unstaged" and back again. This behaviour only occurs when the submodule has uncommitted changes within itself.

To Reproduce

  1. Create a git repository
  2. Create a submodule within said git repository
  3. Make a change and commit it within the submodule
  4. Make a change and DON'T commit it within the submodule
  5. Back out of the submodule, and press "spacebar" on the submodule to stage the committed changes.
  6. Press "spacebar" again on the submodule, and the submodule's changes will not be unstaged.

Expected behavior
When there are unstaged changes within the submodule that cannot be staged due to those changes themselves not being staged within the submodule, pressing spacebar should unstage the current change to the submodule's commit hash.
Spacebar should call git reset $SUBMODULE_NAME instead of git add $SUBMODULE_NAME

Screenshots
Submodule has modified content that has not yet been committed to the submodule, as well as changes that have been committed to the submodule.
Screenshot 2024-06-06 161136
When attempting to unstage this with a "spacebar" keypress, lazygit will attempt to stage the uncommitted changes in the submodule despite it not having a commit.
Screenshot (2)
After this doesn't work, lazygit will reset to the first screenshot showing that the submodule contains modified content.

Version info:
commit=, build date=, build source=unknown, version=unversioned, os=windows, arch=amd64, git version=2.45.1.windows.1
git version 2.45.1.windows.1

Additional context
Version info as of writing seems to be broken on my machine, likely as I've installed lazygit through go install on windows through MSYS2 specific go.
The build I'm using is v0.42.1, but I've had this issue ever since I've been using lazygit.

I'll likely put in a pull request for this issue myself at some point as it doesn't seem too hard to solve.

@RetoranPetra RetoranPetra added the bug Something isn't working label Jun 6, 2024
@RyanTalbot
Copy link

Happy to take this on and give it a go this weekend. Like @RetoranPetra said, it doesn't seem too difficult so not expecting any surprises.

@RetoranPetra
Copy link
Author

Happy to take this on and give it a go this weekend. Like @RetoranPetra said, it doesn't seem too difficult so not expecting any surprises.

Sounds great, I had a quick look today and didn't manage to make a dent in it and I'll be busy this weekend.

@RyanTalbot
Copy link

No trouble recreating the issue. Still working on the actual fix. Will most likely share what I have at this stage for some guidance if no more progress is made soon.

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

2 participants