Submodule context menus: Only show if dir exists #8646
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8104
A few other NBug issues exist. I have considered this to be a too much edge case to fix it. Maybe users experience this before they have downloaded submodules? Or this is an indication that there are few serious NBug issues that are not reported.
There has been cleanups for access to submodule dirs in changes the last year, for instance #7690 and #8117, to not access submodules if the directories does not exist.
Proposed changes
Only show context menus for work tree submodules "internals" if the submodule directories exists, required for the Git commands to run.
For FormCommit, the menus are disabled.
For RevDiff the menus the are not shown. The Controller structure (which is made this way to test) adds another layer to handle enable/disable and makes this quite complicated, it is not worth the effort.
Screenshots
Before
After
Test methodology
Added a test
✒️ I contribute this code under The Developer Certificate of Origin.