mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-12 15:53:33 -04:00
If .gitmodules contains a submodule path like "../other_repo", nuking the working tree in lazygit stashes all changes and untracked files of that other repository. The same happens if the path is a symlink that points to it. The changes can be recovered with "git stash pop" in that repository, but the user has no reason to look there. This happens because lazygit runs some commands in the submodule's directory, and takes that directory from .gitmodules as it is. Git itself only uses a path from .gitmodules if its index has a submodule at that path, and such a path can't lead out of the repository. Ignore a submodule unless its path is a directory below the directory that contains the .gitmodules file, without any symlinks in between. This also keeps GetConfigs from reading the same .gitmodules file again and again for a path of ".". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>