Submodules list is not refreshed on Merge
When I merge a branch that has changes in submodules and the git submodule status output changes (i.e when there are revision_changed or unmerged conflicts in one or more submodule), this is not reflected on the status icon and the tooltip in the SUBMODULES list in the left sidebar. That means the SUBMODULES list may display incorrect status when there's a Merging state in the repo.
Not sure why it's not refreshed in this case, since it usually refreshes even when I just do a checkout inside the submodule directory (causing a revision_changed status). Even doing Update Submodules does not help refresh the status in this situation.
Doing a Fetch seems to make the SUBMODULES list refresh, but since I test this on a sandbox repo without any Remote then Fetch won't run. So currently, I have to restart SourceGit to make the SUBMODULES list show the correct status.
NOTE: Actually, there is one more case where the SUBMODULES list does not refresh. That's when I Stage changes inside the submodule directory, which does not seem to cause a refresh of the modified status of the submodule in the super-repo. (This is less surprising, though, as it would possibly need additional file system monitoring.)
SIDE NOTE: Is there any specific reason that the modified status for Submodules only reflects Staged changes (but not Unstaged changes) in the submodule directory? I suppose this status indicator is supposed to reflect the output of git status in the super-repo, which actually shows modified for both cases of modified content and untracked content. (To fix this, we could simply remove the -uno flag for the git --no-optional-locks status command used in the code.)
TIPS: If there is a situation where the data in SourceGit is not refreshed correctly, you can directly press F5 to reload the entire repository.
TIPS: If there is a situation where the data in
SourceGitis not refreshed correctly, you can directly pressF5to reload the entire repository.
I thought I had tried that, but apparently not. 😆 F5 does indeed refresh the Submodule status and tooltip.
BTW, thank you for making the modified status work also for Unstaged submodule changes! 🌟
Currently, I have to press F5 to get updated submodule status when doing a merge.
NOTE: I'm using --no-commit when I merge, so I always end up in a Merge in progress state, but a resulting unmerged conflict or revision_changed status in a submodule (caused by the merge) will not show up in the SUBMODULES list until I press F5.
Funny enough, if I start the Merge and press F5 to refresh Submodule status, then press ABORT on the Merge in progress, the unmerged or revision_changed status quickly disappears WITHOUT pressing F5.
So, submodule (auto-)refresh seems to run on merge-ABORT but not on Merge... 🤔
To make debugging of watcher issues easier, and to maybe avoid some unnecessary processing, we could make early exit for the following additional FileSystemWatcher filename patterns... 😉
- In
OnRepositoryChanged():name.Contains("fsmonitor--daemon/")(Watching another watcher!) - In
OnWorkingCopyChanged():name.StartsWith(".vs/") && name.EndsWith("/.suo")(File frequently updated by Visual Studio.)
BTW, the reason merge-ABORT triggers a submodule refresh is that the file (not a folder) "my_submodule/.git" appears as changed in OnWorkingCopyChanged(). However, this file is only written to when aborting the Merge, not when starting it.
I have a fix, will make a PR soon!